获取文件为什么我得到错误胁迫到Unicode:需要字符串或缓冲区,诠释发现从用户
file = input("Please enter the data file you wish to open: ")
获取搜索值从用户
value = int(input("Input a number to search for: "))
打开文件
datlist = open(file, "rb")
阅读文件中的行
FileNums = datlist.read().splitlines()
关闭文件
datlist.close()
请复制粘贴您在运行上述脚本时得到的确切错误消息。在*我*机器上,我无法获得您在问题中暗示的错误信息。 –
如果你可以标记答案,如果它帮助你解决你的问题,那将是很好的。 – jbaiter