1. TypeError: string indices must be integers, not str
字符串類型取第index個字符的時候,應該傳入int而不是str。如
1 |
a='abcdef' |
2 |
print a[0] |
3 |
#而不是 print a['0'] |
更常見的情況是把一個string當成了字典在使用 :should_be_dict_but_string['id'] 。這樣的錯誤
