Python Unicode List

I want to join the python unicode list, for example:

a = [u'00', u'0c', u'29', u'58', u'86', u'16'] 

I want a line that looks like this:

 '00:0c:29:58:86:16' 

How can I join this?

+9
python string list unicode
source share
2 answers
 >>> a = [u'00', u'0c', u'29', u'58', u'86', u'16'] >>> u":".join(a) u'00:0c:29:58:86:16' >>> str(u":".join(a)) '00:0c:29:58:86:16' 
+17
source share

How about this:

 if __name__ == "__main__": a = [u'00', u'0c', u'29', u'58', u'86', u'16'] s = u'' j = True for i in a: if j == True: s += i j = False else: s += u':' + i print s 
-2
source share

All Articles