Ians Ramblings Ian's ramblings, daily, ish

11Jun/090

Python Yuck

This may just be because I have gotten so used to Perl and so gladly forgotten my Python days, but I just thought I would put a little posting to help others avoid the annoyance of Python's join syntax.

Perl: -

my $str_items = join(',', @ians_array); Gives you a nice string comma separated

Python: -

str_string=""
str_string.join(",",ians_array)

Gives you join() takes exactly one argument (2 given)

Hmm, you think maybe I have to use that dirty syntax I have seen?

str_string=""
str_string+= ''.join(ians_array)

Hmm apparently working but no delimeter, lets make it even uglier

str_string=""
str_string+= ','.join(ians_array)

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

6 visitors online now
6 guests, 0 members
Max visitors today: 8 at 06:38 am UTC
This month: 8 at 03-09-2010 10:50 am UTC
This year: 21 at 02-25-2010 11:24 am UTC
All time: 21 at 02-25-2010 11:24 am UTC