问题描述
当我阅读数字文本文件时:
1,2,3,4,5,6,7,8
创建列表的方式如下:
dTags = ['1,8']
我不希望列表的开头和结尾都带有单引号,所以我只希望它像这样:
dTags = [1,8]
这是我正在使用的代码:
dTags = []
with open("tagNumbersToTest.txt") as file:
for line in file:
line = line.strip() #or some other preprocessing
dTags.append(line) #storing everything in memory!
#print(dTags)
我该如何实现?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)