File size: 402 Bytes
e3b9b11
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import re

json_data = {'test1@email.com': {'age': 18, 'gender': 'Female', 'hospital': '', 'name': 'tesuser1', 'number': 41414, 'v1': False, 'v1Date': 0,'v2': False, 'v2Date': 0}}

# Extract email address from dictionary key
email = next(iter(json_data))
email_address = re.match(r"[^@]+@[^@]+\.[^@]+", email).group(0)

#print(email_address)
#print (json_data.keys())

print(list(json_data.keys())[0])