python: dictionary comprehension








dict = { 'a':1, 'b':2 }
dict = { k: str(dict[k]) for k in dict.keys() }
print(dict)



No comments:

Post a Comment