Skip to content

Instantly share code, notes, and snippets.

@devmnj
Last active July 5, 2019 08:33
Show Gist options
  • Save devmnj/485e4347442a2b425f1b09c538583b9f to your computer and use it in GitHub Desktop.
Save devmnj/485e4347442a2b425f1b09c538583b9f to your computer and use it in GitHub Desktop.
Python : Converting List into Tuple List
# This code will show how you can convert a list into tuple list
print('Touple meet List')
l1=['Python','C','C++','C#','GO','Dart','Kotlin'] # the list
# List elements to touples
x=[(x,) for x in l1]
print(x)
Out Put
Touple meet List
[('Python',), ('C',), ('C++',), ('C#',), ('GO',), ('Dart',), ('Kotlin',)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment