Nested list (containing unicoded strings)in to a list of strings [duplicate]

301
September 04, 2017, at 4:20 PM

This question already has an answer here:

  • Python string prints as [u'String'] 11 answers
  • Removing u in list 5 answers
  • Remove 'u' from a python list 4 answers

My_list= [u'COL-DO178BCTestObjB-4416815', u'COL-DO178BCTestObjB-4416816', u'COL-DO178BCTestObjB-4416817'] [u'COL03-DO178BCTestObjB-7415422', u'COL-DO178BCTestObjB-4416815', u'COL-DO178BCTestObjB-4416817'] [u'COL-DO178BCTestObjB-4416815', u'COL-DO178BCTestObjB-4416817']

Required_list=[COL-DO178BCTestObjB-4416815,COL-DO178BCTestObjB-4416816,COL-DO178BCTestObjB-4416817,COL03-DO178BCTestObjB-7415422,COL-DO178BCTestObjB-4416815,COL-DO178BCTestObjB-4416817,COL-DO178BCTestObjB-4416815,COL-DO178BCTestObjB-4416817]

How to convert My_list into Required_list My code is below:

for item in range(len(my_list)): print({item.encode('utf-8') for item in my_list[item]})

But my output is set([' ', "'", '-', ',', '1', '5', '4', '7', '6', '8', 'C', 'B', 'D', 'L', 'O', 'T', '[', ']', 'b', 'e', 'j', 's', 'u', 't'])

please help me out..Thanks a lot in advance!

Rent Charter Buses Company
READ ALSO
Relation between HAAR training image size and w/h parameters

Relation between HAAR training image size and w/h parameters

Please help understand the relation of HAAR training positive/negative images size and training width/length parameters

310
What's the most elegant way to accomplish this control flow in Python? [on hold]

What's the most elegant way to accomplish this control flow in Python? [on hold]

Newer coder here; sorry if this question is extremely basic

217
How to generate combinations from arrays? [duplicate]

How to generate combinations from arrays? [duplicate]

This question already has an answer here:

443
SWIG C/python and unsigned char pointers

SWIG C/python and unsigned char pointers

I have a function in the form

312