[Tutor] creating files with python and a thanks
Eve Kotyk
e.kotyk@shaw.ca
Mon, 18 Feb 2002 03:12:55 +0000
>
> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.8 -- press F1 for help
> >>> def gather_data():
> items = raw_input("Add food item: ")
> portion = input("Enter number of portions: ")
> cal_portion = input("Enter calories per portion: ")
> output = [items, portion, cal_portion]
> f = open('myfile.txt', 'w')
> f.write(str(output))
> f.close()
>
>
> >>> gather_data()
> Add food item: cumquats
> Enter number of portions: 10
> Enter calories per portion: 50
> >>>
>
> What Python Shell are you using? What operating system?
I'm using version 1.5.2 on Linux.
>
> --
> Sheila King
> http://www.thinkspot.net/sheila/
>
> "When introducing your puppy to an adult cat,
> restrain the puppy, not the cat." -- Gwen Bailey,
> _The Perfect Puppy: How to Raise a Well-behaved Dog_
--
ekotyk
http://members.shaw.ca/e.kotyk/virtualstudio.htm