【发布时间】:2021-07-17 00:48:37
【问题描述】:
def update(login_info):
stids = 001
file = open('regis.txt', 'r+')
for line in file:
if stids in line:
x = eval(line)
print(x)
c = input('what course you would like to update >> ')
get = x.get(c)
print('This is your current mark for the course', get)
mark = input('What is the new mark? >>')
g = mark.upper()
x.update({c: g})
file.write(str(x))
This is what happens in the idle
如您所见,系统并未将数据写入原始字典。我们该如何改进呢?请详细解释。谢谢大家
【问题讨论】:
-
您为什么使用文本内容的图像?您可以将文本直接复制并粘贴到您的问题中。只有在没有其他方法可以证明问题时才应使用图片。
标签: python-3.x file dictionary