When I print links stored in a text
file, the result I'm getting constantly kinda weird which is in this case a line gap between each link. If i use .strip()
then it fixes the problem but it doesn't seem satisfactory usage. My question is: how can i get usual results other than using .strip()
? Thanks in advance.
This is what I tried:
with open('reverse.txt', 'r') as file:
for item in file.readlines():
print(item)
print(item.strip()) # ain't there any better way? It fixes, though.
The results:
http://metaladhesive.tradeindia.com/
http://www.iari.res.in/
http://www.peekayfarmequipments.com/
What I'm expecting:
http://metaladhesive.tradeindia.com/
http://www.iari.res.in/
http://www.peekayfarmequipments.com/
Btw, the same thing applicable for csv
files as well.