Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

truncate add weird symbols in python

To solve the above error Try This:
  with open('file.txt','r+') as f:
    # Try to seek the position to 0
    f.seek(0)
    f.truncate(0)
for me it solved the problem

OR
import fileinput

for line in fileinput.input('file.txt', inplace=1):
  pass
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #truncate #add #weird #symbols #python
ADD COMMENT
Topic
Name
3+7 =