我正在尝试从令牌变量访问列表元素,但我不断收到错误消息
print token[0]
IndexError: list index out of range'
当我尝试从令牌列表访问元素时。
文件变基文件的内容是:
ZraI 3 GAC'GTC 0 ! AatII >INV
;ZrmI 3 AGT'ACT 0 ! ScaI,AssI,BmcAI >I
代码是:
with open (rebase_file, 'r') as rebase:
lines = rebase.readlines()
string = ''
for line in lines:
token = line.split()
print token[0]