[Tutor] Why Doesn't the for loop Increment?

Stephen P. Molnar s.molnar at sbcglobal.net
Fri Jan 15 09:16:40 EST 2021



On 01/15/2021 08:42 AM, Alan Gauld via Tutor wrote:
> On 15/01/2021 13:24, Stephen P. Molnar wrote:
>> with open('ligands_3') as ligand_file:
>>
>> for ligand in ligand_file:
>>
> You want to add a line here:
>
>
> ligand = ligand.rstrip()
>
>
> That will remove the linefeed which was read from the file.
>
> Cameron had that in his code(I forgot!)...
>
>
>> Now I'm really tearing out what little hair I have left - were did the
> '\n' originate??????
>
> It was in the original ligands file - separating the lines from each other.
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
Words are in adequate to express my thanks for the assistance that I 
have received in solving this problem!!!

It Works!!!!!!!!!!!!!!!!!!!!!!!!!!

MANY, MANY THANKS.

-- 
Stephen P. Molnar, Ph.D.
www.molecular-modeling.net
614.312.7528 (c)
Skype:  smolnar1



More information about the Tutor mailing list