print odd numbers of lines from tekst WITHOUT space between lines
TTaglo
tfente at gmail.com
Sat Feb 18 15:07:48 EST 2017
Op zaterdag 18 februari 2017 18:55:46 UTC+1 schreef boB Stepp:
> On Sat, Feb 18, 2017 at 11:38 AM, TTaglo <tfente at gmail.com> wrote:
> > i = 1
> > f = open ('rosalind_ini5(1).txt')
> > for line in f.readlines():
> > if i % 2 == 0:
> > print line
> > i += 1
> >
> >
> > How do i get output without breaks between the lines?
>
> If you use "print line," (Note the trailing comma.), this should
> suppress the line break that the print statement normally inserts.
>
> Another suggestion might be to use enumerate() instead of using a
> manual counter in your for loop.
>
> HTH!
>
>
>
> --
> boB
thanks for the help !
More information about the Python-list
mailing list