Write a Python program to create a new JSON file from an existing JSON file

  • برمجة
  • برمجة بايثون

Write a Python program to create a new JSON file from an existing JSON file

الأجوبة

import json

with open('states.json') as f:
  state_data= json.load(f)

for state in state_data['states']:
  del state['area_codes']

with open('new_states.json', 'w') as f:
  json.dump(state_data, f, indent=2)
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...