Writing Formatted txt to a file (xtreme newbie q)

Sean Berry sean_berry at cox.net
Mon May 10 19:23:45 EDT 2004


How this will actually be written is dependent on how you have your data
stored.  If it is in a list is it like this

[[question1, answer1], [question2, answer2], etc...]
or
['question1=answer1', 'question2=answer2', etc...]
or some other way.

Once you can tell me that, I am sure I can give you a pretty easy way to
write it out to a formatted file.


"Uri" <phrogeeb at hotmail.com> wrote in message
news:8a0bb987.0405101503.2656788a at posting.google.com...
> I am working on a program that reads (through Tkinter and a form of
> text boxes, checkboxes, radio switches, sliders, etc) a set of values,
> saves them to a file, and is also capable of loading from the file so
> that the sliders switches checkboxes etc will have the paramaters
> defined in the text file (that last part is peripheral, eventual, but
> if there's something i have to do to set that up immediately I'd like
> to do that.)
>
> Right now, I'm basicly doing this in simple question-answer text
> no-GUI format.
>
> I've managed to set up the q&a scenario, and using a print statement
> set it up like I'd like it to go into the file (space-dileneated)
>
> However, I'm lost as far as writing it to the file in a formatted
> form. I've looked around, and I'm pretty sure I can rule out pickle as
> not what i want, but I'm having trouble figuring out what i do want.
> The data is in the format of a list right now (maybe a dictionary at
> some point) and there is one question and one answer per column. I
> would like to set it up as "Question: Answer" in side-by-side
> formatted columns, or perhaps "Question" over "Answer" in two rows,
> answers on bottom.
>
> Thanks in advance!
>
> (Also, is there a pretty popular web-based forum for python or no?)





More information about the Python-list mailing list