...
Now lets try to read a file from a bucket into Python's memory, so we can work with it inside Python without ever saving the file on to our local computer:
| Code Block | ||
|---|---|---|
| ||
#Read a file into Python's memory and open it as a string
filename = '/folder1/folder2/myfile.txt' #Fill this in
obj = s3.get_object(Bucket=bucketname, Key=filename)
myObject = obj['Body'].read().decode('utf-8')
print(myObject) |
...