Re: Is this a bug of str.join?
On 16Feb2011 12:01, Terry Reedy <email@example.com> 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)
| >>> repr(s)
| >>> len(s)
| >>> 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 <firstname.lastname@example.org> 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.