Is this a bug of str.join?

fireinice zhzhqiang at gmail.com
Wed Feb 16 07:24:40 CET 2011


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



More information about the Python-list mailing list