python remove newline when reading in text file code example
Example 1: remove n from string python
a_string = a_string.rstrip("\n")
Example 2: 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)