1. 程式人生 > >Python文字處理筆記(readlines去掉回車+string list to int list)

Python文字處理筆記(readlines去掉回車+string list to int list)

readlines()去掉回車:
f.read().splitlines()

string list –> int list
results = [int(i) for i in results]

char, int 相互轉換:
char = chr(int)
int = ord(char)

判斷是否為字母:
str.isapha(a)

將char list 轉換成 int list
a = [ord(i)-ord(‘0’) for i in a]

vim查詢空行:
/^s*$