name = my_dict.pop('name')
print(name) # John
print(my_dict) # {'age': 30, 'city': 'New York'}