Python Forum
change a text file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: change a text file (/thread-28794.html)



change a text file - Blue Dog - Aug-03-2020

Hello,
I have a text file that is full of emails. Their are many rows and columns of them.
I want to just have a list one email on a line. Can that be done with python.
I am using windows notepad and python 3.6.
The photo be low it what it looks like now.
I want to be able to have each one the the email on its own line.

[Image: email_test.png]

Shy I hope someone know how to do this.
Thank you
Renny


RE: change a text file - Yoriz - Aug-03-2020

Is there no seperation between each eamil address?


RE: change a text file - Blue Dog - Aug-03-2020

ok thanks


RE: change a text file - Yoriz - Aug-03-2020

(Aug-03-2020, 08:34 PM)Yoriz Wrote: Is there no seperation between each eamil address?

(Aug-03-2020, 09:12 PM)Blue Dog Wrote: ok thanks

Huh


RE: change a text file - ndc85430 - Aug-04-2020

Another way to put what Yoriz is asking: how do you tell when one address ends and the next begins? Also, do you really have more than one address in there? All the text looks the same to me..


RE: change a text file - DeaD_EyE - Aug-04-2020

I guess there are 0-bytes between the addresses or other control characters.
Just open the file in binary mode and read the first 20 bytes.
Then you'll see if there is a separator between the e-mail addresses or not.