Answers for "remove new line from file in python"

2

python remove new line

lines = ("line 1 rn")
lines.rstrip("nr")
Posted by: Guest on February-16-2021
0

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("n") != "nickname_to_delete":
            f.write(line)
Posted by: Guest on January-20-2021

Code answers related to "remove new line from file in python"

Python Answers by Framework

Browse Popular Code Answers by Language