Remove u from a tuple

by: Anilt, 9 years ago


Hi,

I have a tuple data like :[(4, u'good'), (1, u'excellent'), (1, u'better')]. I want to remove 'u' from the tuple. Can some one help me on this.

Thanks & Regards
Anil



You must be logged in to post. Please login or register an account.



Encode to ascii, something like:

x = [(4, u'good'), (1, u'excellent'), (1, u'better')]

for i in x:
    print(i[1].encode('ascii'))


-jack.damon 9 years ago
Last edited 9 years ago

You must be logged in to post. Please login or register an account.


Hi Jack,

Thanks, it's working i modified it to print(i[0],i[1].encode('ascii')) as I want to print the count as well.


-Anilt 9 years ago

You must be logged in to post. Please login or register an account.