Is this a bug of str.join?
cs at zip.com.au
Wed Feb 16 23:34:00 EST 2011
On 16Feb2011 12:01, Terry Reedy <tjreedy at udel.edu> 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 <cs at zip.com.au> DoD#743
I'm not making any of this up you know. - Anna Russell
More information about the Python-list