To convert a tuple to a list in Python, you can use the list()
built-in function. Here's an example:
main.py82 chars4 lines
In this code block, my_tuple
is defined as a tuple containing three elements. Then, the list()
function is used to create a new list from my_tuple
, which is assigned to my_list
. Finally, my_list
is printed out to the console using the print()
function.
Using the list()
function is a quick and easy way to convert a tuple to a list.
gistlibby LogSnag