May-06-2020, 11:19 AM
Hi, thank you for clues, it helped me,
the code below worked:
the code below worked:
with open(filepath, 'r+', encoding='utf-8') as data_jason: data = json.load(data_jason) for feature in data['features']: print (feature['geometry']['coordinates'][0]) splitted = feature['geometry']['coordinates'][0].split(',') print(splitted) floated = [float(i) for i in splitted] print(floated) del feature['geometry']['coordinates'] feature['geometry']['coordinates'] = [] feature['geometry']['coordinates'].extend(floated) print(feature['geometry']['coordinates']) json.dump(data, data_jason, indent=4)Dumping write at the end of the file how could I make it overwrite it instead ?