[Tutor] How to Create Webpage with Python

John Cast jdcast at stanford.edu
Tue Jul 15 19:54:00 CEST 2014


Yes, that pretty well sums up what I would like to do.  I can't show the
input here, but it is saved as an xlsx file (this is proving problematic
for me already since I'm using python 3.4 and it doesn't fully support this
format yet...I may have to switch to python 2 for better support).
I don't think this will require very much code, but since I am new to the
language and having trouble finding documentation on methods such as
"saveAs", it's proving difficult.

Thanks again


On Tue, Jul 15, 2014 at 10:39 AM, Joel Goldstick <joel.goldstick at gmail.com>
wrote:

>
>
>
> 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/e55d86d8/attachment.html>


More information about the Tutor mailing list