Re: regular expression for getting content between parentheses

2009-05-07 Thread Rajanikanth Jammalamadaka
Thanks for your replies. I changed the file to look like this: { testName : {"someParam": "value1", "anotherParam": (value2, value3)}, } to make it look like a hash to Python. Thanks, Raj On Thu, May 7, 2009 at 5:19 PM, Rhodri James wrote: > On Fri, 08 May

regular expression for getting content between parentheses

2009-05-07 Thread Rajanikanth Jammalamadaka
Hi I have a text file as follows: testName = ( someParam = value1 anotherParam = (value2, value3) ) how do I write a regular expression to get all the contents of the file which are between the first and last parentheses. In this case, I want: someParam = value1 anotherParam = (value2, va

Re: split a list based on a predicate

2008-10-09 Thread Rajanikanth Jammalamadaka
Thanks for all of your replies. Rajanikanth On Wed, Oct 8, 2008 at 11:59 PM, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > On Oct 8, 6:36 pm, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> > wrote: >> Hi! >> >> Is there a functional way to do

split a list based on a predicate

2008-10-08 Thread Rajanikanth Jammalamadaka
Hi! Is there a functional way to do this? I have an array [0,1,2,3,0,1,2,2,3] and I want the first chunk of non-decreasing values from this array (eg: In this case I want [0,1,2,3]) Thanks, Rajanikanth -- http://mail.python.org/mailman/listinfo/python-list

Re: python-2.6

2008-10-05 Thread Rajanikanth Jammalamadaka
There seems to be a bug with idle on Mac OS X. http://bugs.python.org/issue4017 It has to do something with reinstalling the TCL and TK. If you want to see detailed error messages, open a terminal and type idle at the command prompt. Cheers, Raj On Thu, Oct 2, 2008 at 11:26 PM, <[EMAIL PROT

Re: Python on Mac

2008-08-27 Thread Rajanikanth Jammalamadaka
Hi! Luca, All you need to do is in the final step of (configure, make and make install), use make altinstall instead of make install. That way, your original python implementation won't be affected. Thanks, Raj On Wed, Aug 27, 2008 at 7:46 AM, <[EMAIL PROTECTED]> wrote: > Hi All. > I'm really

Re: dropwhile question

2008-08-23 Thread Rajanikanth Jammalamadaka
Thanks for the explanations. Regards, Raj On Sat, Aug 23, 2008 at 3:41 PM, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Rajanikanth Jammalamadaka wrote: >>>>> >>>>> list(itertools.dropwhile(lambda x: x<5,range(10))) >> >> [5, 6,

dropwhile question

2008-08-23 Thread Rajanikanth Jammalamadaka
>>> list(itertools.dropwhile(lambda x: x<5,range(10))) [5, 6, 7, 8, 9] Why doesn't this work? >>> list(itertools.dropwhile(lambda x: 2http://mail.python.org/mailman/listinfo/python-list

Re: Detect a sequence of keystrokes in an os independent way

2008-08-20 Thread Rajanikanth Jammalamadaka
Hi! I was able to do this in the following way: import os fKey= raw_input('') if fKey=='ab': print(os.listdir(os.getcwd())) Is there a better way to do this? Thanks, Raj On Wed, Aug 20, 2008 at 2:21 PM, Rajanikanth Jammalamadaka <[EMAIL PROTECTED]> wro

Detect a sequence of keystrokes in an os independent way

2008-08-20 Thread Rajanikanth Jammalamadaka
Hi! Can somebody tell me if there is an os independent way to detect a sequence of key strokes. For example, I want to start some other program once the user presses a couple of keys: ex: key a and then key b Thanks, Raj -- "For him who has conquered the mind, the mind is the best of friends;

Re: Vmware api

2008-08-17 Thread Rajanikanth Jammalamadaka
Hi! Luke, You can use the vmrun command for interacting with VMware Workstation/Fusion. You can do something like import os os.system('vmrun start .vmxFile') os.system('vmrun stop .vmxFile') If you can be more specific about your needs, I may be able to help you further. Thanks, Raj On Sun, A

Re: Regular Expressions Quick Question

2008-07-09 Thread Rajanikanth Jammalamadaka
hi! Try this: >>> lis=['t','tes','test','testing'] >>> [elem for elem in lis if re.compile("^te").search(elem)] ['tes', 'test', 'testing'] Cheers, Raj On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: > Alright, basically I have a list of words in a file and I load eac

Re: Returning the positions of a list that are non-zero

2008-07-08 Thread Rajanikanth Jammalamadaka
Try this: >>> li=[0,0,1,2,1,0,0] >>> li [0, 0, 1, 2, 1, 0, 0] >>> [i for i in range(len(li)) if li[i] != 0] [2, 3, 4] Cheers, Raj On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey <[EMAIL PROTECTED]> wrote: > I have a very large list of integers representing data needed for a > histogram that I'

Re: a simple 'for' question

2008-07-08 Thread Rajanikanth Jammalamadaka
/path/way/'+x+'/myfile.txt','r') > > > > > Rajanikanth Jammalamadaka wrote: >> >> Hi! >> >> Try this >> >> for x in folders: >> open('my/path/way'+x+'myfile.txt','r') >> >>

Re: a simple 'for' question

2008-07-08 Thread Rajanikanth Jammalamadaka
Hi! Try this for x in folders: open('my/path/way'+x+'myfile.txt','r') Cheers, Raj On Tue, Jul 8, 2008 at 5:08 PM, Ben Keshet <[EMAIL PROTECTED]> wrote: > Hi fans, > > I want to use a 'for' iteration to manipulate files in a set of folders, > something like: > > folders= ['1A28','1A6W','56Y7

Re: (silly?) speed comparisons

2008-07-08 Thread Rajanikanth Jammalamadaka
Try using a list instead of a vector for the C++ version. Raj On Tue, Jul 8, 2008 at 3:06 PM, mk <[EMAIL PROTECTED]> wrote: > Out of curiosity I decided to make some speed comparisons of the same > algorithm in Python and C++. Moving slices of lists of strings around seemed > like a good test cas