Dec-27-2019, 08:34 AM
Another possibility is to use split('\n') instead of splitlines.
Using data provided by snippsat in file named ip.txt:
Using data provided by snippsat in file named ip.txt:
>>> with open('ip.txt', 'r') as f: ... data = f.read().split('\n') ... >>> data ['203.215.181.219:36342', '200.149.0.74:8080', '46.209.98.227:8080', '150.95.131.174:3128']I still don't understand why it's good idea to strip newlines while reading the file and then put them back while writing to file (I know, I am slow today).
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.