简体   繁体   中英

how to remove double quotes from a dictionary keys?

I have:

{'"Phone numbers"': ['0010', '55200', 'Full Names'], '"Phone numbers"': ['0015','163810', 'Full Names']

how to remove double quotes from a dictionary keys?

Use str.replace in a dict-comprehension for example

x = {'"Phone numbers"': ['0010', '55200', 'Full Names'], '"Phone numbers"': ['0015','163810', 'Full Names']
x = {k.replace('"', ''): values for k,values in x.items()}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM