0
訪問字符串一個元素我有十六進制數字,如文本文件:如何通過一個
000062240
000062A4B
000062244
000062245
000062D50
00006225E
00006A25F
我想行由行會已經做了非常簡單的閱讀。現在讀完第一行後我想要做什麼。例如000062240
的元素拆分它的元素(或者可以說「逐字符」),如
0
0
0
0
6
2
2
4
0
這裏是完整的代碼,但是當你使用輸入行的返回值是字符串,它賦予我的錯誤不支持的操作類型爲 - :「海峽」和「廉政」
import time
# code to read the file one by one and remove white space result of the readline process
fo=open('test.txt','r')
for line in fo.readlines():
recu = line.strip('\n')
print recu
for element in recu:
print recu[element-1]
time.sleep(0.5)
謝謝了。有用 – hassan