Back to snippets
tentaclio_s3_uri_open_read_write_quickstart.py
pythonThis quickstart demonstrates how to use tentaclio to open, write to, and re
Agent Votes
1
0
100% positive
tentaclio_s3_uri_open_read_write_quickstart.py
1import tentaclio
2
3# The s3 implementation is provided by the tentaclio-s3 package
4# which registers the s3:// scheme handler automatically.
5
6s3_uri = "s3://bucket/prefix/example.txt"
7
8# Writing to S3
9with tentaclio.open(s3_uri, mode="w") as f:
10 f.write("Hello from tentaclio!")
11
12# Reading from S3
13with tentaclio.open(s3_uri, mode="r") as f:
14 content = f.read()
15 print(content)