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] Proper way to use **kwargs?

2010-03-15 Thread Rich Lovely
On 15 March 2010 12:38, Karjer Jdfjdf wrote: > I want to use **kwargs to check a list of conditions (if true do this, if > false do nothing) besides required parameters ( in sample a and b). > Sometimes I want to add a Python object (in example a dictionary and a > list). Below is my first **kwar

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 Mar

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

[Tutor] raw_input()

2010-03-15 Thread kumar s
Dear group: I have a large file 3GB. Each line is a tab delim file. example lines of it: 585 chr1433 433 rs56289060 0 + - - -/C genomic insertion unknown 0 0 unknown between 1 585 chr1491 492 rs55998931 0

Re: [Tutor] module.class.method in logging.debug

2010-03-15 Thread spir
On Mon, 15 Mar 2010 13:26:27 -0400 Brian Jones wrote: > I tried a couple of things I could think of, and successfully got the module > and class without issue, but the one missing piece was the method name. All methods and funcs (and types) have a __name__ attr. from types import FunctionType a

Re: [Tutor] Hi there :.)

2010-03-15 Thread Alan Gauld
wrote Just introducing myself to say hiHi! Hi welcome, but please don't include lots of attachments. It blows up people's mailboxes and bandwidth allowances. Better to post them on a website and send a link. I'm very new to programming, ... place to start I found out that python a

Re: [Tutor] Proper way to use **kwargs?

2010-03-15 Thread spir
On Mon, 15 Mar 2010 05:38:43 -0700 (PDT) Karjer Jdfjdf wrote: > I want to use **kwargs to check a list of conditions (if true do this, if > false do nothing) besides required parameters ( in sample a and b).  > Sometimes I want to add a Python object (in example a dictionary and a list). > Bel

Re: [Tutor] Hi there :.)

2010-03-15 Thread Wayne Werner
On Mon, Mar 15, 2010 at 10:23 AM, wrote: > Hey, > Just introducing myself to say hiHi! > > I'm very new to programming, I got interested in it when I decided to have > a go at html. When looking around for a place to start I found out that > python and C++ are the usual starting place bu

Re: [Tutor] local var error

2010-03-15 Thread Alan Gauld
"Prasad" wrote I am writing a function to find correct transformer lamination for specific wattage. It gives an error message: UnboundLocalError: local variable 'stdArea' referenced before assignment Please al;ways senmd the full error text not just the last line. However in your case we ca

[Tutor] local var error

2010-03-15 Thread Prasad
I am writing a function to find correct transformer lamination for specific wattage. It gives an error message: UnboundLocalError: local variable 'stdArea' referenced before assignment def power2lam(): voltAmp=raw_input("How much power in Watts you want to handle?: ") #following dictio

Re: [Tutor] Proper way to use **kwargs?

2010-03-15 Thread Hugo Arts
On Mon, Mar 15, 2010 at 1:38 PM, Karjer Jdfjdf wrote: > > I have 2 questions about this code: > > 1. Can I use this in Python 3 ? I'm not sure if I can use **kwargs in > Python 3 because it uses the "apply" builtin (if I understand it correctly) > > "At this writing, both apply and the special ca

Re: [Tutor] module.class.method in logging.debug

2010-03-15 Thread Brian Jones
On Mon, Mar 15, 2010 at 1:26 PM, Brian Jones wrote: > Hi all, > > I have some code that is a plugin for a larger app, and I'd like to be able > to properly log issues that arise in the plugin code. I may not be > maintaining this code forever, and I'd like the logging to work even if it's > refac

[Tutor] module.class.method in logging.debug

2010-03-15 Thread Brian Jones
Hi all, I have some code that is a plugin for a larger app, and I'd like to be able to properly log issues that arise in the plugin code. I may not be maintaining this code forever, and I'd like the logging to work even if it's refactored later and code moved around, method names change, etc. So I

Re: [Tutor] return first line

2010-03-15 Thread Norman Khine
hi, i tried this, my problem is that the file isfrom a python list - here is the code i have so far: http://paste.lisp.org/+22E5/1 as the first line for each item contains the 'title' which has different tags, i want to find a way to strip this out. any advise much appreciated On Mo

Re: [Tutor] return first line

2010-03-15 Thread Rafik Ouerchefani
Hi, assuming that your content is in input.txt, you can do : >>> f = open("/path/to/content.txt") >>> f.readline() it will return the first line only cheers, - Rafik ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription option

[Tutor] return first line

2010-03-15 Thread Norman Khine
hello, i have this string http://paste.lisp.org/+22E5 which is extracted from an html page file using regex. the issue i have is that i am unsure how to strip the first tag in this case Association NAtionale des Producteurs de QUInoa (ANAPQUI) as on the pages this is not consistent. for example s

[Tutor] Proper way to use **kwargs?

2010-03-15 Thread Karjer Jdfjdf
I want to use **kwargs to check a list of conditions (if true do this, if false do nothing) besides required parameters ( in sample a and b).  Sometimes I want to add a Python object (in example a dictionary and a list). Below is my first **kwargs-brew. ###START def function_with_kwargs(a, b,

Re: [Tutor] Command not issued until after escape from loop

2010-03-15 Thread David Hutto
On Mon, Mar 15, 2010 at 4:53 AM, Alan Gauld wrote: > > "David Hutto" wrote > > Caveat: I know zero about Blender... but... > I *thought* that since the code was in Python it might be the way I was executing it. I think now it might be how the other windows are updated in blender when the command

Re: [Tutor] Command not issued until after escape from loop

2010-03-15 Thread Alan Gauld
"David Hutto" wrote Caveat: I know zero about Blender... but... When I execute the script, it shows my main window, then if I press the CKEY it's *supposed* to call the cleanSlate() function, My problem is, it doesn't execute cleanSlate() until I hit the ESCKEY, or the QKEY.

Re: [Tutor] Command not issued until after escape from loop

2010-03-15 Thread David Hutto
--- On Mon, 3/15/10, David Hutto wrote: > From: David Hutto > Subject: Command not issued until after escape from loop > To: tutor@python.org > Date: Monday, March 15, 2010, 2:15 AM > In the following code, the portion > I'm having a problem with is outlined in stars, but since > the overall c