There seems to be many ways to create a dictionary, which one do you prefer?
bumsfeld 413 Nearly a Posting Virtuoso
abdi1 commented: i need the best and easy one from those +0
kindo commented: Good! This Question made me to Join this forum.Good +0
Recommended Answers
Jump to PostFor those who want to minimize typing ...
# this saves you from having to add quotes around any strings/characters (keys only) dic1 = dict(a=1, b=2, c=3, d=4) print dic1 # {'a': 1, 'c': 3, 'b': 2, 'd': 4}
Jump to PostLet's say you want to create an English to French dictionary. You go to babelfish.altavista.com and enter "one, two, three, four, five, six, seven, eight, nine, ten" tell it to translate that from …
Jump to Post... just one more way to create a dictionary, this one does a character count in a text string and gives you a dictionary of char:count pairs ...
# count the characters in a string and create a dictionary of char:count pairs str1 = 'supercalifragilisticexpialidocious' print "Count …
All 11 Replies
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
bumsfeld 413 Nearly a Posting Virtuoso
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
ajipw 0 Newbie Poster
Gribouillis 1,391 Programming Explorer Team Colleague
babyash 0 Newbie Poster
Enders_Game 13 Newbie Poster
bumsfeld 413 Nearly a Posting Virtuoso
TrustyTony commented: usefull usage +3
Umar Suleman 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.