Is this a bug of str.join?

Stefan Behnel stefan_ml at behnel.de
Wed Feb 16 01:47:29 EST 2011


fireinice, 16.02.2011 07:32:
> On Feb 16, 1:24 am, fireinice<zhzhqi... at gmail.com>  wrote:
>> Hi, all
>> I'm just working around to generate some fake file for parsing. and I
>> notice some weired thing happen.
>>      time = str(random.randint(1000000000000000, 9999999999999999))
>>      s_id = str(random.randint(1000000000000000, 9999999999999999))
>>      p_id = str(random.randint(1000000000000000, 9999999999999999))
>>      a_id = str(random.randint(1000000000000000, 9999999999999999))
>>      s = "test"
>>      a = [time, s_id, p_id, a_id, s]
>>      print '\t'.join(a)
>>
>> the output is:
>> 3107903582321032        6101282916386924        719897196119318 1780339444980186test
>>
>> you can notice that there is no tab between a_id and s
>> if I switch a_id and p_id, it still happen, but if I delete one of
>> ids, the problem gone.
>> I tried this with python2.6 from debian source and python2.3 which I
>> compiled from source. the result are both the same.
>> What happened to str.join?
>> thanks
>
> I'm sorry, I found it should be the terminal width caused visual
> problem, please kindly ignore this post.

Well, there's always this that's worth remembering:

http://www.catb.org/~esr/faqs/smart-questions.html#id478549

Stefan




More information about the Python-list mailing list