[Tutor] CSV row and column width automation
Alan Gauld
alan.gauld at yahoo.co.uk
Wed Jan 3 06:10:11 EST 2018
On 03/01/18 05:31, renukesh nk wrote:
> Is there any way to automatically set the column and row width in a CSV
> file through python script
I'm not sure what you mean. CSV files don't have widths,
they are just sequences of data strings separated by commas.
Each piece of data takes as much space as it needs.
You could write code to force the strings to all
be the same width as the longest string but that would
just be making life harder for yourself when it comes
to extracting it again. CSV is a data transport mechanism
not a display format.
Are you thinking about some kind of display mechanism
like a web page table or a spreadsheet perhaps? They
have widths. But how you set them is very different
so you'd need to tell us what kind of table you have
in mind.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list