Re: [Tutor] raw_input() slice list

2011-09-28 Thread questions anon
Excellent, thank you and yes I need to work on how to catch and handle exceptions Thanks again! On Wed, Sep 28, 2011 at 4:13 PM, bob gailer wrote: > On 9/27/2011 11:18 PM, questions anon wrote: > > I would like to use user_input() to decide how to slice a list. > This works fine until I try to

Re: [Tutor] raw_input() slice list

2011-09-27 Thread bob gailer
On 9/27/2011 11:18 PM, questions anon wrote: I would like to use user_input() to decide how to slice a list. This works fine until I try to leave it blank to try and select the whole list [:] I have posted the section of interest below and the error I get when I try to press enter. Further belo

Re: [Tutor] raw_input

2010-07-06 Thread iamroot
On Mon, 5 Jul 2010, Dipo Elegbede wrote: Hello, I seem to be having problems with raw_input. i wrote something like: raw_input('Press Enter') it comes back to tell me raw_input is not defined, a NameError! Is it that something about it has changed in python 3.1 or I have been writing the w

Re: [Tutor] raw_input

2010-07-05 Thread Sander Sweers
On 5 July 2010 17:40, Shashwat Anand wrote: > use input() instead of raw_input() in Python3.x To add to this, in Python 2 we had input() [1] (unsafe for most uses) and raw_input() [2] (safe). Python 3 removed the old input() and renamed raw_input() to input() [3,4]. Greets Sander [1] http://doc

Re: [Tutor] raw_input

2010-07-05 Thread Dipo Elegbede
Tried it out and it worked. Thanks. Regards, On 7/5/10, Shashwat Anand wrote: > use input() instead of raw_input() in Python3.x > > On Mon, Jul 5, 2010 at 8:50 PM, Dipo Elegbede wrote: > >> Hello, >> >> I seem to be having problems with raw_input. >> >> i wrote something like: >> >> raw_input('P

Re: [Tutor] raw_input

2010-07-05 Thread Shashwat Anand
use input() instead of raw_input() in Python3.x On Mon, Jul 5, 2010 at 8:50 PM, Dipo Elegbede wrote: > Hello, > > I seem to be having problems with raw_input. > > i wrote something like: > > raw_input('Press Enter') > > it comes back to tell me raw_input is not defined, a NameError! > > Is it th

Re: [Tutor] raw_input a directory path

2010-05-13 Thread Hugo Arts
On Fri, May 14, 2010 at 2:37 AM, Dave Angel wrote: > The other approach is to have the user type in the text according to some > escaping language (like the one used for literals), and explicitly decode > that after the raw_input().  I thought there was a way in the stdlib, but I > can't seem to f

Re: [Tutor] raw_input a directory path

2010-05-13 Thread Hugo Arts
On Fri, May 14, 2010 at 12:17 AM, Spencer Parker wrote: > In these files I also have some special characters I need to remove, but I > cannot figure out how to specify this. > I need to remove a vertical tab and a formfeed character.  How would I > specify to remove these characters?  I have tried

Re: [Tutor] raw_input a directory path

2010-05-13 Thread Spencer Parker
In these files I also have some special characters I need to remove, but I cannot figure out how to specify this. I need to remove a vertical tab and a formfeed character. How would I specify to remove these characters? I have tried \v and \f On Thu, May 13, 2010 at 8:48 AM, Spencer Parker wrot

Re: [Tutor] raw_input a directory path

2010-05-13 Thread Spencer Parker
I figured out the issue...for some reason it works with the trailing slash, but not without it. Once I do that...everything is all good... On Wed, May 12, 2010 at 8:00 PM, Dave Angel wrote: > > > Spencer Parker wrote: > >> Here is the code: >> http://dpaste.com/hold/193862/ >> >>

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Dave Angel
Spencer Parker wrote: Here is the code: http://dpaste.com/hold/193862/ It still isn't working for me. I don't see it hitting the first for loop or even the second one. It runs without an error at all. I am inputing the directory as: \\Documents\ and\ Settings

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Alan Gauld
"Spencer Parker" wrote Here is the code: http://dpaste.com/hold/193862/ First comment: why are you using print followed by raw_input? You could put the prompt string inside raw_input - if you need a new line just put a \n in the prompt string. It will shorten and clarify the code.

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Spencer Parker
esktop\\test On Wed, May 12, 2010 at 3:07 PM, Spencer Parker wrote: > Spreading it to the list... > > > -- Forwarded message -- > From: Spencer Parker > Date: Wed, May 12, 2010 at 3:07 PM > Subject: Re: [Tutor] raw_input a directory path > To: Luke Paire

Re: [Tutor] raw_input a directory path

2010-05-12 Thread Luke Paireepinart
On Wed, May 12, 2010 at 2:44 PM, Spencer Parker wrote: > I have a search and replace script that I am having the user put in the > directory path as raw_input.  The problem lies when I run the script it > doesn't pick that up for some reason.  Is there an appropriate way to take a > directory path

Re: [Tutor] raw_input a directory path

2010-05-12 Thread spir ☣
On Wed, 12 May 2010 13:44:30 -0600 Spencer Parker wrote: > I have a search and replace script that I am having the user put in the > directory path as raw_input. The problem lies when I run the script it > doesn't pick that up for some reason. Is there an appropriate way to take a > directory p

Re: [Tutor] raw_input()

2010-03-16 Thread Steven D'Aprano
On Tue, 16 Mar 2010 11:27:13 am you wrote: > I think he thinks that python is going to read the whole 3.6GB of > data into memory in one hit, rather than using a small amount of > memory to process it line by line. But "for line in datafile" in your > code above uses a generator, right? So I don't

Re: [Tutor] raw_input()

2010-03-15 Thread Alan Gauld
"kumar s" wrote For example: x1.py = second = raw_input() x = second.split('\t') y = x[1:] print '\t'.join(y) %cat mybigfile.rod | python x1.py chr1433 433 rs56289060 0 + - - -/C genomic insertion unknown 0 0 unknown between 1 My qu

Re: [Tutor] raw_input()

2010-03-15 Thread Benno Lang
On 16 March 2010 08:28, Steven D'Aprano wrote: > On Tue, 16 Mar 2010 10:22:55 am kumar s wrote: >> thanks Benno. >> >> supplying 3.6 GB file is over-kill for the script. > > Then supply a smaller file. > > >> This is the reason I chose to input lines on fly. > > I don't understand what you are try

Re: [Tutor] raw_input()

2010-03-15 Thread Steven D'Aprano
On Tue, 16 Mar 2010 10:22:55 am kumar s wrote: > thanks Benno. > > supplying 3.6 GB file is over-kill for the script. Then supply a smaller file. > This is the reason I chose to input lines on fly. I don't understand what you are trying to say. -- Steven D'Aprano

Re: [Tutor] raw_input()

2010-03-15 Thread Steven D'Aprano
On Tue, 16 Mar 2010 09:52:26 am kumar s wrote: > Dear group: > I have a large file 3GB. Each line is a tab delim file. [...] > Now I dont want to load this entire file. I want to give each line as > an input and print selective lines. datafile = open("somefile.data", "r") for line in datafile:

Re: [Tutor] raw_input()

2010-03-15 Thread kumar s
thanks Benno. supplying 3.6 GB file is over-kill for the script. This is the reason I chose to input lines on fly. thanks Kumar - Original Message From: Benno Lang To: kumar s Cc: tutor@python.org Sent: Mon, March 15, 2010 7:19:24 PM Subject: Re: [Tutor] raw_input() On 16

Re: [Tutor] raw_input()

2010-03-15 Thread Benno Lang
On 16 March 2010 08:04, kumar s wrote: > %cat mybigfile.rod | python x1.py > Traceback (most recent call last): >  File "x1.py", line 2, in >    second = raw_input() > EOFError: EOF when reading a line > > How to notify that at EOF break and suppress exception. try: second = raw_input() exce

Re: [Tutor] raw_input()

2010-03-15 Thread kumar s
Here it worked after trying a while loop: x1.py = while True: second = raw_input() x = second.split('\t') y = x[1:] print '\t'.join(y) %cat mybigfile.rod | python x1.py Traceback (most recent call last): File "x1.py", line 2, in second = raw_inpu

Re: [Tutor] raw_input into range() function

2007-04-18 Thread Ben Sherman
On 4/18/07, Guba <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to do the exercises in Michael Dawson's "Absolute Beginner" > book. In chapter four ("for Loops, Strings, and Tuples") one of the > challenges is: "Write a program that counts for the user. Let the user > enter the starting number

Re: [Tutor] raw_input into range() function

2007-04-18 Thread Bob Gailer
Guba wrote: > Hello, > > I am trying to do the exercises in Michael Dawson's "Absolute Beginner" > book. In chapter four ("for Loops, Strings, and Tuples") one of the > challenges is: "Write a program that counts for the user. Let the user > enter the starting number, the ending number, and the amo

Re: [Tutor] raw_input into range() function

2007-04-18 Thread Kent Johnson
Guba wrote: > The code I have come up with so far is further below; basically my > problem is that I don't know how to feed the range() function with the > user-input numbers it expects. > # Telling the player what to do & assigning that info to variables. > start_num = int(raw_input("Please give