Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Re: Is this a bug of str.join? (

Cameron Simpson 02-17-2011 04:34 AM

Re: Is this a bug of str.join?
On 16Feb2011 12:01, Terry Reedy <> wrote:
| On 2/16/2011 1:32 AM, fireinice wrote:
| >I'm sorry, I found it should be the terminal width caused visual
| >problem, please kindly ignore this post.
| For future reference, the way to get more info about what is really
| in a string is to print its repr(), or even its list() version.
| Len() is also helpful. On Windows, both the Command Prompt window
| and IDLE refuse to expand tabs, so
| >>> s='\t'.join(('a','b','c'))
| >>> str(s)
| 'a\tb\tc'
| >>> repr(s)
| "'a\\tb\\tc'"
| >>> len(s)
| 5
| >>> list(s)
| ['a', '\t', 'b', '\t', 'c']

And on UNIX, a common way to inspect program output at the character
level is like this:

python my_python-program | od -c

possibly sent off into a temp file. That will let you see what character
are actually escaping from the program (versus terry's suggestion, which
is good for looking at the characters before they escape).

Cameron Simpson <> DoD#743

I'm not making any of this up you know. - Anna Russell

All times are GMT. The time now is 04:20 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.