Skip to content

Instantly share code, notes, and snippets.

@jmartinter
Last active March 21, 2023 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmartinter/5e1273e8267784b1205bb5bdf5d377a9 to your computer and use it in GitHub Desktop.
Save jmartinter/5e1273e8267784b1205bb5bdf5d377a9 to your computer and use it in GitHub Desktop.
import cloudstorage as gcs
input = 'geo_shapes/cities.geojson'
output = '/geo-shapes/cities.geojson'
with open(input, 'r') as f_in:
with gcs.open(output, mode='w', content_type='application/json') as f_out:
for line in f_in:
f_out.write(line + '\n')
@jmartinter
Copy link
Author

Input is a json file with line breaks. We want to keep these breaks in order to read our GCS file line by line later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment