Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Dictionary comprehension - convert to lowercase
#python 2.7.12 my_dict = {u'customer': [u'GS808E', u'GS810EMX'], u'tablets': [u'Apple IPAD PRO', u'Apple IPAD MINI', u'IPAD'], u'gaming_consoles': [u'SONY PLAYSTATION 4', u'XBOX ONE S', u'PLAYSTATION'], u'range_of_days': 14 }; my_dict = { key: ([item.lower() for item in my_dict[key]] if type(my_dict[key]) == type([]) else my_dict[key]) for key in my_dict} print my_dict
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
python permutations
coupon
20/2
MPS encoding
Aufgabe 16
binary
functional python - from hackernoon.com, lean functional python in 10 min
Chain
mad libs game
Problem: rstring
stackse - search stackoverflow differently
Please log in to post a comment.