我找不到使用 python 将数据集从本地机器写入谷歌云存储的方法。我已经研究了很多,但没有找到任何关于此的线索。需要帮助,谢谢 原文由 Aditya Bhatt 发布,翻译遵循 CC BY-SA 4.0 许可协议
快速示例,使用 google-cloud Python 库: from google.cloud import storage def upload_blob(bucket_name, source_file_name, destination_blob_name): """Uploads a file to the bucket.""" storage_client = storage.Client() bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob(destination_blob_name) blob.upload_from_filename(source_file_name) print('File {} uploaded to {}.'.format( source_file_name, destination_blob_name)) 此 GitHub 存储库中有更多示例: https ://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/storage/cloud-client 原文由 Brandon Yarbrough 发布,翻译遵循 CC BY-SA 3.0 许可协议
快速示例,使用 google-cloud Python 库:
此 GitHub 存储库中有更多示例: https ://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/storage/cloud-client