[Tutor] Create file and input text

David david at abbottdavid.com
Sun Jun 29 02:11:03 CEST 2008


Hi, I am very new to python and it is my first attempt at programing 
except for some basic bash scripts. I came up with this;
#!/usr/bin/python

import os
filename = raw_input('Enter the filename: ')
fobj = open(filename, 'w')
yourname = raw_input('What is your name: ')
fobj.write(yourname)
fobj.close()

It seems to work Ok, I was shocked! Is it OK?

-- 
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com



More information about the Tutor mailing list