Sunday, March 25, 2012

Python study notes (String, List, Dictionary)

Compare the properties of String, List and Dictionary

String List Dictionary
'devpage' ['devpage',12] {'CsaByte':30, 'Susan':28}
Sequence of characters List of elements Set of pairs
immutable mutable mutable
s[i] - char in s p[i] - element in p d[k] - value associated with k-key in d
s[i] = 'a' - error,doesn't work p[i] = 7 d[k] = v

No comments:

Post a Comment