Answers for "python remove newline when reading in text file"

2

remove n from string python

a_string = a_string.rstrip("n")
Posted by: Guest on July-01-2020
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 "python remove newline when reading in text file"

Python Answers by Framework

Browse Popular Code Answers by Language