Python Forum
How to print data in bracket in list in one side.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print data in bracket in list in one side.
#1
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
Reply
#2
Try something like this:
for i in mdx:
  print(i[1])
Reply
#3
Thank you Sonia ! The problem is solved.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 409 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  print(data) is suddenly invalid syntax db042190 6 1,196 Jun-14-2023, 02:55 PM
Last Post: deanhystad
  How do you get Python to print just one value in a list? 357mag 3 1,013 May-17-2023, 09:52 PM
Last Post: rob101
  Grouping Data based on 30% bracket purnima1 4 1,195 Mar-10-2023, 07:38 PM
Last Post: deanhystad
  How to horizontally align and display images side-by-side in an email using Python? shantanu97 0 1,004 Feb-22-2023, 11:41 PM
Last Post: shantanu97
  Print List to Terminal DaveG 2 1,437 Apr-02-2022, 11:25 AM
Last Post: perfringo
  Get the Client-Side TLS ? JohnnyCoffee 1 1,348 Nov-30-2021, 10:49 PM
Last Post: Larz60+
  Why changing data in a copied list changes the original list? plumberpy 3 2,233 Aug-14-2021, 02:26 AM
Last Post: plumberpy
  how to print all data from all data array? korenron 3 2,472 Dec-30-2020, 01:54 PM
Last Post: korenron
  4D array with only elements on one side of the diagonal schniefen 0 1,689 Dec-24-2020, 11:32 AM
Last Post: schniefen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020