简体   繁体   中英

How to read and update a field in JSON file that's in Google cloud using Python script

How to read and update a field in JSON file that's in Google cloud using Python script. I've tried using

with open(filepath, 'r')

Where filepath was a gs path location

gs://bucket-name/path

But I was getting FileNotFoundError . Is there any other way to read and update a field in JSON that's in Google cloud using Python?

If you want to read or write a file you need to use Google Cloud Storage library. The Google Cloud Storage library is a client library for accessing Google Cloud Storage services. This library provides several methods for interacting with objects in Cloud Storage, including methods for reading and updating objects.

You can check this document on Reading and writing to Cloud Storage for more information and code samples.

Also check the below similar example

How to Read.json file in python code from google cloud storage bucket

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM