1.upload file.py 190 B

123456
  1. import boto3
  2. s3 = boto3.resource('s3')
  3. for bucket in s3.buckets.all():
  4. print(bucket.name)
  5. data = open('test.txt', 'rb')
  6. s3.Bucket('myfirstbucketkb').put_object(Key='test.txt', Body=data)