string:
list:
list與string相互轉換:
mylist = list(str)
str = ''.join(mylist)
字典:
dict = {},dict = {'key1': value1, 'key2': value2, ... }
遍歷:
for key in dict:
print 'key = %s, value = %s' % (key, dict[key])
Python正則:
re.findall("regex", target)
返回所有匹配到的結果,放存到list
re.search("regex" , "src" , re.IGNORECASE)
匹配到第一個結果,返回matchobject
re.IGNORECASE 忽略大小寫
雜記:
ord('a') = 97 #字符的ACSII值:
print "str", #‘,’使print不換行