Python Forum

Full Version: How to print data in bracket in list in one side.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have to print a list partially, data inside bracket, but in a right side, here is the code:

...
print("mdx:",mdx)

    mdx.sort()

    for indice in range(lg):
            print(mdx[indice])
Résult :

mdx: [(1, 0), (4, 1), (0, 2), (3, 3), (2, 4)]

(0, 2)
(1, 0)
(2, 4)
(3, 3)
(4, 1)


I need to display only the second data in the parentheses, like this:

2
0
4
3
1


Thanks for any help. Big Grin
Try something like this:
for i in mdx:
  print(i[1])
Thank you Sonia ! The problem is solved.