Python Tutorial – How to make Text-Based Tables

///Python Tutorial – How to make Text-Based Tables

Python Tutorial – How to make Text-Based Tables

FavoriteLoadingAdd to favorites

–message from the future (aka 2019)–
I really don’t know why this video is so high up in search results, but it does the job I guess. Please disregard any unprofessionalism in the video, or this channel, given I was 15 at the time ๐Ÿ˜ถ more programming tutorials on the main channel soon maybe~~
–end message–

This is quite a strange video, but it’s for some people and I thought I’d just make it public… please don’t judge my terrible programming explanations.
(cough)JS is better than Python(cough)

source

By |2020-03-20T02:27:55+00:00March 20th, 2020|Python Video Tutorials|28 Comments

28 Comments

  1. Anjali Dwivedi March 20, 2020 at 2:27 am - Reply

    Hey programmer there if being an unknown user I want to find a particular record of a person from created table then how could we do that

  2. Anjali Dwivedi March 20, 2020 at 2:27 am - Reply

    I want one horizontal line after header as well , any trick for that or I could print minus minus minus. That seems 'unpythonic' ,right?Suggest something for that.

  3. Paul Bradley March 20, 2020 at 2:27 am - Reply

    I'm just learning Python now, and this stuff is identical to what i need to accomplish in chapter 6 of Automate the Boring stuff in Python. appreciate it a lot. The book didn't even cover an example close to this and expected it. Do you want to be a mentor ? lol (actually not kidding) Great vid fine sir

  4. PocketOfPlenty March 20, 2020 at 2:27 am - Reply

    Amazing. Saved me a ton of mental torment. Thanks!

  5. Clayton Ribardo March 20, 2020 at 2:27 am - Reply

    how on earth is this a strange video?? i was confused to death before this and finding info on it was impossible

  6. SternerRegnix March 20, 2020 at 2:27 am - Reply

    Thank you, great help for my work!

  7. Josh ___ March 20, 2020 at 2:27 am - Reply

    For people still looking at this, there is a much more efficient way to do this

    for item in nestedlist:

    print('| %-11s | %-14s | %-5s |'%tuple(item))

    There are other ways to do this if you want to use the new .format() method instead.

  8. Alexander Prog March 20, 2020 at 2:27 am - Reply

    much easier to use the function "ljust" ๐Ÿ˜‰

  9. Advik Singh March 20, 2020 at 2:27 am - Reply

    let we want to make a function for displaying table and print the rows dynamically and if the length of next item is bigger than the previous one. how will be setup how many spaces to print?

  10. Anshul Joshi March 20, 2020 at 2:27 am - Reply

    You can simply make use of simple python packages like PrettyTable and Tabulate; they are way easier to use.

  11. Jay Tuff March 20, 2020 at 2:27 am - Reply

    good video but this does not work when writing code for a txt file.

  12. Diogo Almeida March 20, 2020 at 2:27 am - Reply

    Thanks man! Really helpful video!

  13. John Delta March 20, 2020 at 2:27 am - Reply

    "JS is better than Python" its really not, one cannot be "better" than another. Honestly just depends on what you're trying to do.

  14. Noah Cremers March 20, 2020 at 2:27 am - Reply

    you're my hero right now

  15. bailey125 March 20, 2020 at 2:27 am - Reply

    Also may I point out that if you make all your tables the same length, you can use a FOR loop for the range of the number of elements and add ",end=''" onto the end of the print. This will print to the same line, saving you from having a long line or big block of print statements. Then don't forget to print("") just after the loop to then be able to print to the next line.

    See here for an example: https://i.imgur.com/lfRYQxP.png

    You could even make it work with different width columns if you changed the '6' in my example to a variable.

  16. Geomar Paul March 20, 2020 at 2:27 am - Reply

    thanks ๐Ÿ˜€

  17. Deepak Kumar March 20, 2020 at 2:27 am - Reply

    Thanks

  18. Niels Schlegel March 20, 2020 at 2:27 am - Reply

    When I try this it gives me an error-message: IndexError: string index out of range

  19. Wubologist March 20, 2020 at 2:27 am - Reply

    Holy shit thank you so much for this video. Helped me tremendously with a programming project for school.

  20. Toby Reinhardt March 20, 2020 at 2:27 am - Reply

    Thanks, helped me format my table nicely!

  21. Alan Chu March 20, 2020 at 2:27 am - Reply

    I'm trying to code that asks for 3 siblings first names. Then asks for the siblings' last name only once (one time, not 3 times) How do I code?
    (this is how it might look , Im stuck)
    First Name Last Name
    —————- —————-
    Jeff Linton
    Aaron Linton
    Seth Linton

  22. Tom Wasser March 20, 2020 at 2:27 am - Reply

    Very good and I took some things from it… the only issue is that by converting the numbers to a string they are then left justified rather than right justified as numbers would be.

  23. Andrew Haley March 20, 2020 at 2:27 am - Reply

    Great video. I've been working with dictionaries trying to get this sort of functionality, but no more!

  24. David Yang March 20, 2020 at 2:27 am - Reply

    Amazing video. Found it really useful for my IGCSEยดs controlled assessment

  25. Koustav Roy March 20, 2020 at 2:27 am - Reply

    please tell me how to take this tabular form in txt file in python
    pleasee help

  26. muhammad ali March 20, 2020 at 2:27 am - Reply

    Can you help me as I need set up a numerical tables in Python from 1-49.

    Cheers

  27. KTmyName March 20, 2020 at 2:27 am - Reply

    Help alot thanxx dude, keep up the good work!!

  28. Tylasian March 20, 2020 at 2:27 am - Reply

    Do you know Lua?

Leave A Comment

*