Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    0
    ReputationRep:
    Name:  how.jpg
Views: 58
Size:  113.9 KB
    How to create table like this in Python?
    Offline

    20
    ReputationRep:
    (Original post by varsketis)
    Name:  how.jpg
Views: 58
Size:  113.9 KB
    How to create table like this in Python?
    Print it out line by line, adding spaces where necessary to keep the columns in line.
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by morgan8002)
    Print it out line by line, adding spaces where necessary to keep the columns in line.
    Any way to make the lines in bold?
    Ty btw.
    Offline

    20
    ReputationRep:
    (Original post by varsketis)
    Any way to make the lines in bold?
    Ty btw.
    Tbh I'm not sure. I think it depends on what terminal you're using. Doing a Google search for "python print bold" or similar will give you several methods, which may work depending on your terminal.
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by morgan8002)
    Tbh I'm not sure. I think it depends on what terminal you're using. Doing a Google search for "python print bold" or similar will give you several methods, which may work depending on your terminal.
    Thanks
    Offline

    2
    ReputationRep:
    If you're still needing help, here's a way to do it which I found from stack overflow:

    Code:
    teams_list = ["Man Utd", "Man City", "T Hotspur"]
    data = [[1, 2, 1],
            [0, 1, 0],
            [2, 4, 2]]
    row_format = "{:>15}" * (len(teams_list) + 1)
    print(row_format.format("", *teams_list))
    for team, row in zip(teams_list, data):
        print(row_format.format(team, *row))
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    What's your favourite Christmas sweets?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.