I have a dictionnary and i would like to rename all the keys with this patter (test number 1 => testNumber1)
there is my dict:
{'id': '4', 'event title': 'Coldplay World Tour', 'event start date': '29/07/2022 20:30', 'event end date': '30/07/2022 01:00', 'name of the location hosting the event (optional)': 'Stade de France', 'address of the location': '93200 Saint-Denis', 'total ticket number': '10000', 'maximum tickets per user': '6', 'sale start date': '04/05/2022', 'line up': '', 'asset url': 'https://coldplay.com/coldplay_asset.mp4'}
on another json -i have done these 2 elems:
self.json_informations[i]['smart_contract']['collectionName'] = self.json_informations[i]['smart_contract'].pop('collection name') #on remplace collection par collectionName
but it will be too long to change all the params (and its not really flexible).0
I tried a loop too but it didn't work:
for j in range(len(self.json_informations[0])): #my dict is in json_informations[0]
print(self.json_informations[0][j])
but it gives me an error
print(self.json_informations[i][j])
KeyError: 0
i would like to get this result as my output
{'id': '4', 'eventTitle': 'Coldplay World Tour', 'eventStartDate': '29/07/2022 20:30', 'eventEndDate': '30/07/2022 01:00', 'nameOfTheLocation': 'Stade de France', 'addressOfTheLocation': '93200 Saint-Denis', 'totalTicketNumber': '10000', 'maximumTicketsPerUser': '6', 'saleStartDate': '04/05/2022', 'lineUp': '', 'assetUrl': 'https://coldplay.com/coldplay_asset.mp4'}
thanks for yours answers!