Closed Ten-Mao closed 2 years ago
请问这为什么就报错了?(见下图,跳转链接)打开的那个文件里面只有一个数123
发一下 high_score.txt?
high_score.txt
read() 会从文件指针向后读取字符串,用 a+ 打开文件指针在结尾,因此向 eval() 传递空字符串会导致报错 可改为r(只读)或r+(读写)打开,或使用 file.seek() 函数修改文件指针位置
请问这为什么就报错了?(见下图,跳转链接)打开的那个文件里面只有一个数123![image](https://user-images.githubusercontent.com/89233661/130653858-2c451fde-d8a9-4b89-8b1e-aab8fccc6ff5.png)