I'm working on a script that reads in a text and processes, pretty straight forward stuff I do all the time. However, this time it only reads in about 512 lines of a file that is tens of thousands of lines long. The file doesn't look truncated or anything so there must be a stray EOF
in the file. How do I work around this? Here is a little code snippet I put together to troubleshoot this:
objFileIn = open(strFilein, "r")
strJson = objFileIn.read()
objFileOut = open(strFixedjason,"w")
objFileOut.write(strJson)
objFileOut.close()
objFileIn.close()
strFilein
points to a json file that is 20,550 lines long. strFixedjason
has 512 lines in it.
question from:
https://stackoverflow.com/questions/65921773/python-read-only-returns-partial-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…