0

I have a dictionary which contains tuples, which in turn, contain strings & integers. I want to convert them to series of strings separated by comma.

new = [('POU5F1', 13), ('BICD1', 11), ('VEGFA', 10)]
links = [', '.join([t[0] for t in new])]
print(links)

How can I convert this to the following format:

 print(links)
 ['POU5F1', 'BICD1', 'VEGFA']
J.A
  • 204
  • 1
  • 4
  • 13
  • Possible duplicate of http://stackoverflow.com/questions/12974474/how-to-unzip-a-list-of-tuples-into-individual-lists – Thiru Mar 31 '17 at 09:14
  • Possible duplicate of [How to unzip a list of tuples into individual lists?](http://stackoverflow.com/questions/12974474/how-to-unzip-a-list-of-tuples-into-individual-lists) – Thiru Mar 31 '17 at 09:16

1 Answers1

1

Hope this code can help:

new = [('POU5F1', 13), ('BICD1', 11), ('VEGFA', 10)]
links = []

for i in new:
    links.append(i[0])

print(links)
Huy Chau
  • 2,178
  • 19
  • 26