我希望能够收集一个字符串列表,该列表将较大的字符串除以标记 ',
但是,我不断收到此错误:
TypeError: string indices must be integers, not str
如果有人可以看一下,这是我的代码
for f in phonebook:
print f
if phonebook[f] + phonebook[f+1] == "'," :
lineString = phonebook[startpoint:(f+1)]
arrayOfStrings[j] = lineString
startpoint = f+2
j = j+1 #iterate through the array
return arrayOfStrings
我最终希望代码的示例如下:
打印 arrayOfStrings[1]
+445557284
打印 arrayOfStrings[4]
+445558928 等