what is the pythonic way to processs "\n" in line of a file
readline or readlines or replace '\n' by myself
example file(t.txt):
221.177.0.0/16
117.128.0.0/21
221.183.0.0/16
when i use the code below read the file(t.py):
import sys
fn = sys.argv[1]
lines = list()
with open(fn) as f:
for line in f:
lines.append(line)
print lines
when run script code, i get this output:
python t.py t.txt
['221.177.0.0/16\n', '117.128.0.0/21\n', '221.183.0.0/16\n']
there many "\n" in list.