Home > Software design >  I CANNOT get rid of brackets when trying to print these lists for some reason
I CANNOT get rid of brackets when trying to print these lists for some reason

Time:01-30

enter image description here

I have tried most methods but for some reason it just does not want to print without the brackets. Why is that??

CodePudding user response:

It means that list1 and/or list2 are lists of lists. Try:

for x in list1:
    print(x[0])
for y in list2:
    print(y[0])

CodePudding user response:

It is probably caused by an extra axis. Try this:

for x in list1[0]:
     print(x)

CodePudding user response:

If you want to just print the list without square brackets use the command: print(*x,sep=" ")

  • Related