File.open
File.open(*, start_byte=0, end_byte=None) → io.BytesIO
Parameters:
Returns:
Examples
import redivis
from io import TextIOWrapper
# See https://redivis.com/datasets/yz1s-d09009dbb/files for example data
table = redivis.table("demo.example_data_files:yz1s:v1_3.example_file_types:4c10")
file = table.file("pandas_core.py")
with file.open() as f:
f.read(100) # read 100 bytes
with TextIOWrapper(file.open()) as f:
f.readline() # read first line
# We can use streams to work with files similarly
# to if they were on disk, e.g.:
from PIL import Image
# Note that PIL will automatically call open() on the file
Image.open(table.file("bogota.tiff"))
Last updated
Was this helpful?

