appending to an existing line in a txt file

前端 未结 3 609
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 13:45

I have a program to store a persons name and their score, in a txt file in python.

for example this is my current code :

name = input(\"Name: \")
score =         


        
3条回答
  •  借酒劲吻你
    2021-01-26 14:26

    Unfortunately with ordinary text files you will need to rewrite the file contents to insert into the middle. You might consider just processing the file to produce the output you want at the end instead of inserting into the middle of the file.

提交回复
热议问题