I want to print list of list in python 3.x with below code, but it is giving an error.
lol=[[1,2],[3,4],[5,6],['five','six']]
for elem in lol:
print (":".join(elem))
# this is the error I am getting-> TypeError: sequence item 0: expected str instance, int found
I am expecting this output:
1:2
3:4
5:6
five:six
I could achieve the same output using below perl code (this is just for reference):
for (my $i=0;$i<scalar(@{$lol});$i++)
{
print join(":",@{$lol->[$i]})."\n";
}
How do I do it in python 3.x?