Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to remove all line in file python

with open("yourfile.txt", "r") as file_input:
    with open("newfile.txt", "w") as output: 
        for line in file_input:
            if line.strip("
") != "nickname_to_delete":
                output.write(line)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #line #file #python
ADD COMMENT
Topic
Name
6+4 =