Re: [Tutor] Create file and input text

2008-06-29 Thread Cédric Lucantis
Le Sunday 29 June 2008 22:32:23 David, vous avez écrit : > Cédric Lucantis wrote: > > Well, you're asking the user to enter -1 after the raw_input, so if the > > file exists your script will just print 'File exists... -1 to quit' and > > open it anyway. See my previous post for a better way of hand

Re: [Tutor] Create file and input text

2008-06-29 Thread David
Cédric Lucantis wrote: Well, you're asking the user to enter -1 after the raw_input, so if the file exists your script will just print 'File exists... -1 to quit' and open it anyway. See my previous post for a better way of handling it, but in your case you should at least do something like t

Re: [Tutor] Create file and input text

2008-06-29 Thread Cédric Lucantis
Le Sunday 29 June 2008 21:53:17 David, vous avez écrit : > Dave Kuhlman wrote: > > On Sat, Jun 28, 2008 at 08:11:03PM -0400, David wrote: > >> 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 >

Re: [Tutor] Create file and input text

2008-06-29 Thread David
Dave Kuhlman wrote: On Sat, Jun 28, 2008 at 08:11:03PM -0400, David wrote: 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(filen

Re: [Tutor] Create file and input text

2008-06-29 Thread Cédric Lucantis
Le Sunday 29 June 2008 21:18:31 Dave Kuhlman, vous avez écrit : > On Sat, Jun 28, 2008 at 08:11:03PM -0400, David wrote: > > 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 > >

Re: [Tutor] Create file and input text

2008-06-29 Thread Dave Kuhlman
On Sat, Jun 28, 2008 at 08:11:03PM -0400, David wrote: > 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') >

Re: [Tutor] Create file and input text

2008-06-29 Thread David
wesley chun wrote: The first line, the import of the 'os' module, is superfluous: it's not being used. oops, good catch danny... i didn't even see that. Python won't let you break any laws of gravity. But there are a lot of good people here on Tutor who will be happy to be of ass

Re: [Tutor] Create file and input text

2008-06-28 Thread wesley chun
> The first line, the import of the 'os' module, is superfluous: it's > not being used. oops, good catch danny... i didn't even see that. > Python won't let you break any laws of gravity. But there are a lot > of good people here on Tutor who will be happy to be of assistance > when the pro

Re: [Tutor] Create file and input text

2008-06-28 Thread Danny Yoo
>> #!/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? Hi David, The fir

Re: [Tutor] Create file and input text

2008-06-28 Thread wesley chun
> Hi, I am very new to python and [...] 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 w

[Tutor] Create file and input text

2008-06-28 Thread David
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.