[Tutor] How to Create Webpage with Python

Joel Goldstick joel.goldstick at gmail.com
Tue Jul 15 19:39:41 CEST 2014


On Tue, Jul 15, 2014 at 12:48 PM, John Cast <jdcast at stanford.edu> wrote:

> Yes, that's exactly what I'm trying to do.  However, when testing this out
> manually like I pointed to above, the output of the save as feature freezes
> the column widths.  This would be fine except that not all of the column
> widths are expanded so that all of the text can be seen (at the moment I
> don't have any control over how the sheets are made, just access to them),
> so when the save as feature does its thing, some text is blocked.
> That's why I need a way to go through each sheet and adjust the widths and
> then programmatically do a save as webpage for all of them from python.
>
> So I guess this brings me back to my previous post's questions:
>
> 1) How does one automate the save as webpage from python?
>
> 2) What is the most straightforward way to adjust the column widths of the
> existing excel sheets?
>
> Any hints/guidance/answers are greatly appreciated.
>
> Thanks again
>

I see you have received guidance as to web hosting, but I have questions
about the excel side.

Does the program that creates the spreadsheet produce an xls formatted
file, or a csv file?

You seem to indicate that want to write python to actually perform the
steps you would do if you were editing the spreadsheet in person:
  1. open the file in excel
  2. click on the various columns to make them expand to see the data
properly
  3. Save as some file in html format.
  4. put that file in some location to be read by your web server.

If your files are csv you can use python csv file to read them, then create
the web page by inserting each value in an appropriately created html
template (with <table> markup).

Can you show the actual input file here? and the markeup for your output
file as well?

If you are doing this on a windows machine, there may be a module that
manipulates .xls files directly using something they used to call .com
objects, I can't help you there except to say that seems like a bad way to
go.  Computer programs are best written to solve a problem, but not usually
to act as a stand in for the steps that would be used to solve that problem
as a user by hand.





_______________________________________________

> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140715/174df3db/attachment-0001.html>


More information about the Tutor mailing list