[Tutor] Saving files in Python, etc.

karthik Guru karthikg@aztec.soft.net
Fri, 30 Nov 2001 15:05:25 +0530


name=raw_input("What is your name?")
age =input("How old are you?")
favcolor=raw_input("What is your favorite color?")

fileObj = open("test.txt","w") // open for for write
fileObj.write(name)
fileObj.write(age)
fileObj.write(favcolor)
fileObj.close()



-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Cow
Sent: Friday, November 30, 2001 1:34 PM
To: tutor@python.org
Subject: [Tutor] Saving files in Python, etc.


Hey, my name is Ryan.

I have been programming Visual Basic for about 2 years (on and off) and i
decided i wanted to learn another programming language to go along with it.
I looked around and found Python to be very appealing.  I decided to give it
a go and i love it.  I am slowly learning the basics and newer things ever
day.  I plan to make a Text editor 9or program similiar to one) in Python,
but i do not know how to save a file in Python.  lets say i have:

name=raw_input("What is your name?")
age =input("How old are you?")
favcolor=raw_input("What is your favorite color?")

and after the user enters in that information, i want it to save the values
of the variables into a new text file.  how could you do that with Python
code?

Also, how can you change the color of the console window (in which your
program runs in) using code in Python?

Thanks a bunch
-Ryan

_____________________________________________________________
Free eSweeet Mail - http://www.esweeet.com

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor