Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48850

Re: Simple I/O problem can't get solved

From Jussi Piitulainen <jpiitula@ling.helsinki.fi>
Newsgroups comp.lang.python
Subject Re: Simple I/O problem can't get solved
Date 2013-06-21 12:11 +0300
Organization University of Helsinki
Message-ID <qotwqpn3k1h.fsf@ruuvi.it.helsinki.fi> (permalink)
References <4785de5f-a84d-4417-9709-68bf2f4076e8@googlegroups.com>

Show all headers | View raw


nickgan.sps@windowslive.com writes:

> I think I coded it correctly but still I get no output. I do not
> have any errors I just do not get any output.
> 
> This is the code:
> 
> ***
> import is_palindrome
> 
> filename = raw_input('Enter a file: ') # A text file
> f = open(filename)
> while True:
> 	line = f.readline()
> 	if len(line) == 0:
> 		break
> 	elif is_palindrome.is_palindrome(line):	
> 		print line,
> f.close()

There's a newline at the end of each input line. Strip that. (It might
be another sequence that means end-of-line in your system. It can
still be stripped as trailing whitespace. Strings have a method for
stripping trailing whitespace.)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Simple I/O problem can't get solved nickgan.sps@windowslive.com - 2013-06-21 01:57 -0700
  Re: Simple I/O problem can't get solved Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-21 12:11 +0300
  Re: Simple I/O problem can't get solved Peter Otten <__peter__@web.de> - 2013-06-21 11:15 +0200
    Re: Simple I/O problem can't get solved nickgan.sps@windowslive.com - 2013-06-21 02:20 -0700
  Re: Simple I/O problem can't get solved Chris Angelico <rosuav@gmail.com> - 2013-06-22 19:07 +1000
  Re: Simple I/O problem can't get solved Peter Otten <__peter__@web.de> - 2013-06-22 12:11 +0200
  Re: Simple I/O problem can't get solved Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-22 12:58 -0400

csiph-web