Tutorial: Formatted Output in Python

preview_player
Показать описание
How to generate formatted reports in Python. Learn in simple and jargon-free language. This is especially helpful to class XII CBSE Computer Science students in their project work. In general it is useful to any learner learning Python.
Рекомендации по теме
Комментарии
Автор

Nicely explained sir, very good, good going. I am following you here

KRISHCHAUHAN
Автор

Sir I was working on my CS project file. This video is absolutely amazing.
Thank you sir! Good Job!

samarthsathyakarthik
Автор

Thank you for a very useful video! Everything was explained very well and straight to the point. The subject is relevant for real world use of python.

TheSuperUser
Автор

Awesome!!! Can't be better. Thank you.

khoil
Автор

Thank you sir for this wonderful video..., Please upload a video for generating automatic sequential numbers also.. Thank you very much sir....

sheelalaijo
Автор

Thanks for the video. It's really inspirational.

Though I can get my target result with tabulate and prettytable,
I'am interested in finding out how to do that without 3rd party library.

My case is simply stack the pronunciation on top of each word of a sentence.

e.g. (the translation case)
pron1, pron2, pron3, eng4, eng5, eng6 <--- pronunciation_line
word1, word2, word, 3, word4, word, 5, word6 <--- word_line

with each 'pron' right on top (aligned center) of each word.

The use of 'maximum length' of the longest word / pronunciation is the same as that of the widest column.

The hardest part is, the number of words in a sentence varies case by case.

The concept that I followed is to get the "single_word" space alignment is as follows:

for line in lines:
... for item in line:


I assigned a variable to a variable called 'single_word'

single_word =[ for item in line ] for line in lines ]

pronunciation_line = ' '.join(single_word ... for item in pronunciation line)
word_line = ' '.join(single_word ... for item in pronunciation line)

return

It's slightly off but almost get there.

I found the format can't center according to column width because:

1) font has to be monospaced (like the one you use in console)
2) the spacing setting of the text editor that you print your output to

Taking into account of the 2 factors above,
I can say 'prettytable' gives a more consistent job
as it allows 'c' (center alignment) within column.

Anyhow, thanks for your inspiration.

clueple
Автор

Thanks a lot sir
I understood everything
I would really like it if you could also do a video on stacks and queues

futurestar
Автор

Can we all appreciate the time and effort for these superb videos! 👏😊💯

yogeshsirfanclub
Автор

Thank you very much for your excellent video. It is really helpful.

leaput
Автор

Thanks you so much for your video, I have a question please. How would you do if you would have write a scientific number and at the same time reserve some number of spaces and align it? For example write the number 3.24e+02 and -4.21E-02 with right align in a 13 spaced position

tivnator
Автор

Thank you. How you would use this concept to track a list of items on the command line where each item on the list is constantly updated in real time? Like if I had a list of things in the oven that all had a different amount of cook time left?

anzwertree
Автор

Informative video. I have a doubt. .if the name is more than 20 character. How will the tail end of name will come in the below row

bhushan
Автор

Do you have any video for using format method of string object? My assignment accepts only format method.

bijaycentury
Автор

nice vid sir, hope to see my comment in class!

ronith
Автор

Recently i was introduced to the tabulate which works much more in similar way

sanketkumarshevkar
Автор

Thank you so much it really helped me alot!!!😄😄

damienang
Автор

Thanks sir I understand but ur telling very fast

dinesh