Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Is this a bug of str.join?

Reply
Thread Tools

Re: Is this a bug of str.join?

 
 
Cameron Simpson
Guest
Posts: n/a
 
      02-17-2011
On 16Feb2011 12:01, Terry Reedy <(E-Mail Removed)> 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).

Cheers,
--
Cameron Simpson <(E-Mail Removed)> DoD#743
http://www.cskk.ezoshosting.com/cs/

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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments