line break confusion

John Machin sjmachin at lexicon.net
Sat Feb 16 06:18:34 EST 2002


Michael Mell <mike at nthwave.net> wrote in message news:<mailman.1013827165.15861.python-list at python.org>...
[snip] 
> In the string module, whitespace = ' \t\n\r\v\f' (5 characters here).

1. space
2. tab
3. line feed
4. carriage return 
5. vertical tab
6. form feed

... looks like 6 to me

> Yet, when I run this:
> >>> import string
> >>> for c in string.whitespace:
> >>>     print '.'+ c + '.'
> 
> I get 7 results.
> What's going on here?
> 

You are counting the interpreter prompting output of "..." because it
looks similar to the print output. 6 + 1 = 7.

Try print '-' + repr(c) + '-'



More information about the Python-list mailing list