【发布时间】:2020-04-29 00:46:34
【问题描述】:
我正在从文本文件中读取行,我希望列表中的每一行都属于数组中不同元素的一部分。
with open("diceRoll.txt","r") as x_file:
contents = x_file.readlines()
oneScore = contents[count-1]
oneScore = oneScore.split(" ")
print(oneScore)
n = oneScore[0] + " " + oneScore[
当我运行程序一次时,我得到这个响应:
['i', '68']
当我运行程序两次时,我得到了这个响应:
['i', '68j', '22']
如何更改我的代码,以便在我运行程序两次时收到68, j,,而不是'68j'?
【问题讨论】: