Re: strip newlines and blanks

2006-05-02 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hi > i have a file test.dat eg > > abcdefgh > ijklmn > <-newline > opqrs > tuvwxyz > > > I wish to print the contents of the file such that it appears: > abcdefgh > ijklmn > opqrs > tuvwxyz > > here is what i did: > f = open("test.dat") > while 1: >

Re: strip newlines and blanks

2006-05-02 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > thanks..and sorry, i am using the web version of google groups and > didn't find an option i can edit my post It's usenet, you can't edit posts. > so i just removed it.. Which doesn't work at all. Stupid thing they allow you to try and delete something o

Re: strip newlines and blanks

2006-05-02 Thread micklee74
thanks..and sorry, i am using the web version of google groups and didn't find an option i can edit my post, so i just removed it.. thanks again for the reply.. -- http://mail.python.org/mailman/listinfo/python-list

Re: strip newlines and blanks

2006-05-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > i have a file test.dat eg > > abcdefgh > ijklmn > <-newline > opqrs > tuvwxyz > > > I wish to print the contents of the file such that it appears: > abcdefgh > ijklmn > opqrs > tuvwxyz > > here is what i did: > f = open("test.dat") > while 1: > line

Re: strip newlines and blanks

2006-05-02 Thread Peter Otten
[EMAIL PROTECTED] wrote: Mick, you should be a bit more patient. Allow for some time for an answer to arrive. Minor edits of your question don't warrant a repost. > i have a file test.dat eg > > abcdefgh > ijklmn > <-newline > opqrs > tuvwxyz > > > I wish to print the contents of

strip newlines and blanks

2006-05-01 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn <-newline opqrs tuvwxyz I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open("test.dat") while 1: line = f.readline().rstrip("\n") if line == '':