lundi 1 août 2016

How to append variables to a string inside for loop in python?

I am trying to append variable inside for loop (cname[0].decode('utf-8')). In php we could do like this :

TotalData .= ",".$cname[0];

How we could achieve same thing using python ?(ouput be 1,2,3,,4)

for cname in match:
         TotalData .= ","+cname[0].decode('utf-8');

print TotalData

Aucun commentaire:

Enregistrer un commentaire