I often forget it, so make a note
"ho" in "hoge" # True
"hogehoge".replace('h', 'k') # "kogekoge"
"hogehoge".replace('h', '') # "ogeoge"
"".join([str(x) for x in l]) # "String"
"\t".join([str(x) for x in l]) # "tsv"
"hogehoge".count('h') # 2
from collections import Counter
Counter("hoge nga kuke".split()) # {"hoge":1, "nga":1, "kuke":1}
ord('a') # 97
chr(97) # a
import re
jap = re.compile("[Ah-Hmm]")
print(jap.findall("Hogehoge nga ward hair")) # ['Ho','Ge','Ho','Ge']
I will do my best in Unicode for kanji and symbols Unicode:Wikipedia => http://ja.wikipedia.org/wiki/Unicode
Recommended Posts