Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python read and delete line from file

with open("yourfile.txt", "r") as f:
    lines = f.readlines()
with open("yourfile.txt", "w") as f:
    for line in lines:
        if line.strip("
") != "nickname_to_delete":
            f.write(line)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #read #delete #line #file
ADD COMMENT
Topic
Name
8+1 =