tags:

views:

88

answers:

5

I have an executable (converted to exe from python using py2exe) that outputs lists of numbers that could be from 0-50K lines long or a little bit more. While developing, I just saved them to a TXT file using simple f.write. The person wants to print this output on paper! (don't ask why lol)

So, I'm wondering if I can output it to something like HTML? XML? Something that could display tables of 50K lines and maybe 3 columns and that would also run in any PC without additional programs? Suggestions?

EDIT:
Regarding CSV:
In most situations the best way in my opinion would be to make a CSV. I'm not opposing it in anyway, rather I think others might find Lott's answer useful for their cases. Sorry I didn't explain it that well in my question as far as my constraints go.
My constraints are: the user doesn't have an office suite, no python installed. Just think of a PC that has the bare minimum after a clean windows xp/vista installation, maybe Internet Explorer 7 or 8. This PC has to be able to open my output file and allow for reasonable viewing, searching, and printing.

+1  A: 

You could use LaTeX to produce a PDF, maybe? But why exactly isn't a text file good enough?

static_rtti
A text file is not good enough in my opinion because when it comes to printing, fonts, preview etc is not that easy to do. I think I'll go with .HTML
chiurox
+6  A: 

CSV.

http://docs.python.org/library/csv.html

http://en.wikipedia.org/wiki/Comma-separated_values

They can load a spreadsheet and print anything they want.

S.Lott
ninjad. +1. I'll add am leery of handing around any format besides human readable. html could be an idea, but that will be harder to use outside of print or on screen. A better idea might be CSV, which is still just a text format, but can be imported losslessly into just about everything, like for example, Excel.
TokenMacGuy
I should add that the person is pretty much computer illiterate. No computer experience until last couple of weeks (senior citizen). So maybe asking him to open Excel (don't even know if he has it) would be overkill. But CSV is definitely a nice way I agree.
chiurox
@chiurox: They don't need to "open excel". Most OS will launch an appropriate piece of software if you double-click any CSV file. Windows will fire up Excel by default. Mac OS X will launch Numbers or OpenOffice. Even Linux will do something useful with CSV. Doesn't require much literacy. And "computer illiterate" passes quickly.
S.Lott
I'm afraid the person doesn't have any office already installed. If it opens with notepad, wouldn't it be all like xx,xx,xx,xxx?
chiurox
@chiurox: How is it possible to find a computer with no office suite? Install Open Office.org. http://www.openoffice.org/ And yes, a CSV file will have the values separated with commas (that's the definition -- comma separated values.)
S.Lott
@S.Lott: I share and understand your indignation. I would offer to install Open Office or anything else, but that's more work from MY part for a rather trivial program. It would also involve me driving over there to install the office suit. If it were up to me, I would just email him my .py and ask him to install Python to run my script. Imagine telling this to a person that has a hard time typing google.com in his browser? We shouldn't 'underestimate' senior citizens' computer ability, but we shouldn't overestimate it either.
chiurox
"indignation"? I think not. You may be indignant, but I'm not. At this point your comments seem to diverge so far from your question that I'm lost as to what your requirements actually are.
S.Lott
@TokenMacGuy, Excel is still limited to 32k lines as far as I know
gnibbler
A: 

You can produce a PDF using Reportlab. After all if you really want full control of the printed output, there's nothing that beats PDF.

Simon Hibbs
+3  A: 

If you can't install anything on the computer, the you might be best off outputting an HTML file with the data in a <table> that the user could view/search/print in IE.

Dan Breen
Yeah, that's what I did. It works well for my purposes.
chiurox
A: 

Does 50k lines make too large a file? If not, just continue writing text files. Otherwise an easy solution would be to continue spitting out text files and compress them, e.g. with zip. You could use the zipfile library in Python. Most computers have no trouble reading zip files.

Brian Hawkins