аватар question@mail.ru · 01.01.1970 03:00

Python, from a motorcade to a line

a motorcade {"" "34", "76", "0", "532"} how to pull out the numbers from this motorcade so that when the output does this form?

   34 ,  76 ,  0 ,  532      

I just have thoughts to put on the list, then pull out, but still have quotation marks, how to get rid of them? {, , "" "" 532 "} lst = [] for i in a: lst.append (i) print (lst) [ '' '`` ">' '' ' , '' 34 ', ' 0 ', ' '76' ]

аватар answer@mail.ru · 01.01.1970 03:00

at least, (if there is confidence that only numbers in theenia) can be added to the list of numbers, not lines, that is, instead of lst.ppend (i) , add lst.ppend (int (i)) , but there is a shorter way:

   "" "" " .join (a)  

The conclusion will be

   '0, 34, 532, 76'                                        

Latest

Similar