On 10/9/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> hanumizzle wrote:
> (snip)
> > Regexes are usually passed as literals directly to re.compile().
>
> For which definition of "usually" ?
>From definition of personal experience: all of the code I've written
or seen that used small regexes
hanumizzle wrote:
(snip)
> Regexes are usually passed as literals directly to re.compile().
For which definition of "usually" ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailma
[EMAIL PROTECTED] wrote:
> I think I am very close the return line is tripping me up. (this is
> the first list that I have tried to program in python)
>
> return (s.group[1], s.group[2])
>
> Traceback (most recent call last):
> File "C:\Python24\Lib\site-packages\boa-constructor\test of
> sna
I am not sure if I am having trouble with the test program or the
routine.. (I had the brackets in the wrong place on the other)
IDLE 1.1.3 No Subprocess
>>>
['1', 'String pad']
>>>
I get this but I have at least three lines and the
v = []
v = csoundroutines.csdInstrumentList('ba
I think I am very close the return line is tripping me up. (this is
the first list that I have tried to program in python)
return (s.group[1], s.group[2])
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\boa-constructor\test of
snake\test_of_csoundroutines_list.py", line
On 6 Oct 2006 23:09:08 -0700, MonkeeSage <[EMAIL PROTECTED]> wrote:
>
>
> On Oct 6, 11:33 pm, hanumizzle <[EMAIL PROTECTED]> wrote:
> > import re
> >
> >
> >
> > if line.startswith('instr'):
> > p = re.compile(r'(\d+)\s+;(.*)$')
> > m = p.search(line)
> >
> > return (m.group(1), m.group(2))
>
I was trying something like this
digits = re.compile("\d")
if digits in line
instr_number = digits.search(line)
because it looked realy cool when I saw it in a recent post... and then
the same thing
for just (';') didn't seem to return anything except one line and some
hex that cam
On Oct 6, 11:33 pm, hanumizzle <[EMAIL PROTECTED]> wrote:
> import re
>
>
>
> if line.startswith('instr'):
> p = re.compile(r'(\d+)\s+;(.*)$')
> m = p.search(line)
>
> return (m.group(1), m.group(2))
You probably don't want startswith, in case there are initial spaces in
the line. Also, sin
On 10/7/06, goyatlah wrote:
> Think you need a regex like this: regex =
> r"\s*instr\s+([0-9]+)\s*(;.*)?"
[0-9] maybe written simply as \d (d for digit)
> Then:
> import re
> test = re.compile(regex)
Regexes are usually passed as literals directly to re.compile().
> testing is done as follows:
Think you need a regex like this: regex =
r"\s*instr\s+([0-9]+)\s*(;.*)?"
Then:
import re
test = re.compile(regex)
testing is done as follows:
res = test.match(mystring)
if res:
number = res.group(1) # always a string consisting of decimals
comment = res.group(2) # string starting with ;
On 6 Oct 2006 21:07:43 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I want comment returned in an array and instr_number returned in an
> array.
Let me see if I understand what you want: if there is a line that
starts with instr (best tested with line.startswith('instr') :)), you
want th
p.s. this is the one I need to finish to release the csoundroutines
library
www.dexrow.com
[EMAIL PROTECTED] wrote:
> apologies if I annoy and for spacing (google)
>
>
>
> def csdInstrumentList(from_file):
> "Returns a list of .csd instruments and any comment lines after the
> instrument"
>
12 matches
Mail list logo