473,696 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newbe's re question

All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from

http://python-forum.org/py/viewtopic.php?t=1703

thanks in advance the hole routine is down below..


Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3.  
  4. "takes an .csd input file and grabs instr_number instrument and
  5. creates output_File_Name"
  6. f = open (input_File_Name , 'r')                #opens file passed
  7. in to read
  8. f2 = open (output_File_Name, 'w')               #opens file passed
  9. in to write
  10. instr_yes = 'false'                             #set flag to false
  11.  
  12. for line in f:                                  #for through all
  13. the lines
  14. if "instr" in line:                           #look for instr in
  15. the file
  16. if instr_yes == 'true':                    #check to see if
  17. this ends the instr block
  18. break                                #exit the block
  19.  
  20. reline = re.line.split('instr', '/d$')     #error probily
  21. split instr and /d (decimal number into parts) $ for end of line
  22. number = int(reline[1])                  #convert to a
  23. number maybe not important
  24. if number == instr_number:            #check to see if
  25. it is the instr passed to function
  26. instr_yes = "true":                 #change flag to
  27. true because this is the instr we want
  28. if instr_yes = "true":                        #start of code to
  29. copy to another file
  30. f2.write(f.line)                         #write line to
  31. output file
  32.  
  33. f.close                                         #close input file
  34. f2.close
  35.  
  36.  
Sep 20 '06 #1
13 1718
Er*********@msn .com wrote:
All I am after realy is to change this

reline = re.line.split(' instr', '/d$')
If you think this is the only problem in your code, think again; almost
every other line has an error or an unpythonic idiom. Have you read any
tutorial or sample code before typing this python-like pseudocode ?

George

Sep 20 '06 #2

George Sakkis wrote:
Er*********@msn .com wrote:
All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

If you think this is the only problem in your code, think again; almost
every other line has an error or an unpythonic idiom. Have you read any
tutorial or sample code before typing this python-like pseudocode ?

George
better to offend a python than a rattlesnake (you have to see the cwa
rattlesnake shirts shirts compared to the python shirts) :)

As long as it will run but I feel like I am just converting it to
something that feels like c somewhat but I am learning the commands
(hopefully).. hard to get a good chapters with questions at the end
without cash... I am happy even if the code isn't pythonic if it runs
with this.

import csoundroutines

extractCsdInstr ument("bay-at-night.csd", "test.orc", 1)

http://www.dexrow.com

Sep 20 '06 #3
Hi Eric,

Don't let people offput you from learning python. It's a great
language, and is fun to use. But really, George does have a point -- if
you want to learn python, then the best way is to swim with the tide
rather than against it. But still, don't worry too much about being
pythonic and whatnot (many people would disagree with me here), just
write the code that _you_ (and your team) feel the most comfortable
with, and helps you be the most productive. But again, many of the
conventional pythonic ways to do things are such because people have
tested various ways and found those to be the best. So don't just blow
off convention, either. Find a happy medium between your coding style
and the conventions, and then you'll really become as productive as you
can be. That's my opinion. And only my opinion. But if it helps you
too, that's good. :)

Ps. Do have a look at the tutorials and other guides available, they
should help you out alot (e.g., the regexp tutorial [1]).

[1] http://www.amk.ca/python/howto/regex/

Regards,
Jordan

Sep 20 '06 #4
Er*********@msn .com wrote:
All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.

Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3.     "takes an .csd input file and grabs instr_number instrument and
  4. creates output_File_Name"
  5.     f = open (input_File_Name , 'r')
  6.     f2 = open (output_File_Name, 'w')
  7.     instr_yes = 'false' # Python has built-in booleans
  8.                                # Also, use sane naming: isInstr or hasInstr
  9.     for line in f:
  10.       if "instr" in line:
  11.            if instr_yes == 'true': # Use the bool -- `if hasInstr:`
  12.                break
  13.            reline = re.line.split('instr', '/d$')     # ???
  14.            number = int(reline[1])
  15.                 if number == instr_number:      # Doesn't need to be 2 lines
  16.                 instr_yes = "true":                 # the `:` is a syntax error
  17.       if instr_yes = "true":
  18.            f2.write(f.line) # odd way of doing it...
  19.     f.close()
  20.     f2.close()
  21.  
Did you read the HOWTO on regular expressions yet? It's included with
the standard documentation, but here's a link:

http://www.amk.ca/python/howto/regex/

Now, onto the issues:
1) The escape character is \, not /. Use "\d" to match a number.

2) I'm not sure I understand what you're trying to extract with your
regex. As it is, the expression will return a list containing one item,
a string identical to the line being matched up to, but not including,
the first number. The rest of the line will be discarded. Try Kiki, a
tool for testing regular expressions, before burying the expression in
your code.

3) Python has built-in booleans: True and False, no quotes. Use them so
that you don't get flamed on forums.

4) I don't claim to be a Python guru, but here's a massaged version of
the function you gave:

Expand|Select|Wrap|Line Numbers
  1.  
  2. def extractCsdInstrument (inputPath, outputPath, instrId):
  3. """ Takes a .csd file, grabs info for instrument ID and writes to
  4. file. """
  5. src = open(inputPath, 'r')
  6. dst = open(outputPath, 'w')
  7. for line in src:
  8. if "instr" in line:
  9. info_comment = line.split(";", 1) # [info, comment]
  10. # Extract integers
  11. instrInfo = re.split(r"[^0-9]*", info_comment[0])
  12. # Check the second number in the line
  13. if instrInfo[1] == str(instrId):
  14. dst.write(instrInfo.append(info_comment[1]))
  15. src.close()
  16. dst.close()
  17.  
  18.  
I didn't check if this actually works, since I don't know what a .csd
file looks like. There are of course other, better ways to do it, but
hopefully this leads you in the right direction.

5) Please, read the documentation that came with your Python
installation. Reading up on string methods etc. ahead of time will save
you much more time than trying to slug through it. Also consider using
a text editor with syntax highlighting; that will help catch most
obvious syntax errors during coding.

Sep 20 '06 #5
Er*********@msn .com wrote:
All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from

http://python-forum.org/py/viewtopic.php?t=1703

thanks in advance the hole routine is down below..


Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3.     "takes an .csd input file and grabs instr_number instrument and
  4. creates output_File_Name"
  5.     f = open (input_File_Name , 'r')                #opens file passed
  6. in to read
  7.     f2 = open (output_File_Name, 'w')               #opens file passed
  8. in to write
  9.     instr_yes = 'false'                             #set flag to false
  10.     for line in f:                                  #for through all
  11. the lines
  12.       if "instr" in line:                           #look for instr in
  13. the file
  14.            if instr_yes == 'true':                    #check to see if
  15. this ends the instr block
  16.                break                                #exit the block
  17.            reline = re.line.split('instr', '/d$')     #error probily
  18. split instr and /d (decimal number into parts) $ for end of line
  19.            number = int(reline[1])                  #convert to a
  20. number maybe not important
  21.                 if number == instr_number:            #check to see if
  22. it is the instr passed to function
  23.                 instr_yes = "true":                 #change flag to
  24. true because this is the instr we want
  25.       if instr_yes = "true":                        #start of code to
  26. copy to another file
  27.            f2.write(f.line)                         #write line to
  28. output file
  29.     f.close                                         #close input file
  30.     f2.close
  31.  

Eric,
From your problem description and your code it is unclear what
exactly it is you want. The task appears to be rather simple, though,
and if you don't get much useful help I'd say it is because you don't
explain it very well.
I believe we've been through this before and your input data is
like this

data = '''
<CsoundSynthesi zer>;
; test.csd - a Csound structured data file

<CsOptions>
-W -d -o tone.wav
</CsOptions>

<CsVersion ;optional section
Before 4.10 ;these two statements check for
After 4.08 ; Csound version 4.09
</CsVersion>

<CsInstrument s>
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
</CsInstruments>

<CsScore>
; originally tone.sco
f1 0 8192 10 1
i1 0 1 20000 1000 ;play one second of one kHz tone
e
</CsScore>

</CsoundSynthesiz er>

Question 1: Is this your input?
if yes:
Question 1.1: What do you want to extract from it? In what format?
if no:
Question 1.1: What is your input?
Question 1.2: What do you want to extract from it? In what format?
Question 2: Do you need to generate output file names from the data?
(One file per instrument?)
if yes:
Question 2.1: What do you want to make your file name from?
(Instrument number?)
Regards

Frederic

Sep 20 '06 #6

Frederic Rentsch wrote:
Er*********@msn .com wrote:
All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from

http://python-forum.org/py/viewtopic.php?t=1703

thanks in advance the hole routine is down below..


Expand|Select|Wrap|Line Numbers
  1.  def extractCsdInstrument (input_File_Name, output_File_Name,
  2.  instr_number):
  3.  
  4.      "takes an .csd input file and grabs instr_number instrument and
  5.  creates output_File_Name"
  6.      f = open (input_File_Name , 'r')                #opens file passed
  7.  in to read
  8.      f2 = open (output_File_Name, 'w')               #opens file passed
  9.  in to write
  10.      instr_yes = 'false'                             #set flag to false
  11.  
  12.      for line in f:                                  #for through all
  13.  the lines
  14.        if "instr" in line:                           #look for instr in
  15.  the file
  16.             if instr_yes == 'true':                    #check to see if
  17.  this ends the instr block
  18.                 break                                #exit the block
  19.  
  20.             reline = re.line.split('instr', '/d$')     #error probily
  21.  split instr and /d (decimal number into parts) $ for end of line
  22.             number = int(reline[1])                  #convert to a
  23.  number maybe not important
  24.                  if number == instr_number:            #check to see if
  25.  it is the instr passed to function
  26.                  instr_yes = "true":                 #change flag to
  27.  true because this is the instr we want
  28.        if instr_yes = "true":                        #start of code to
  29.  copy to another file
  30.             f2.write(f.line)                         #write line to
  31.  output file
  32.  
  33.      f.close                                         #close input file
  34.      f2.close
  35.  
  36.  
Eric,
From your problem description and your code it is unclear what
exactly it is you want. The task appears to be rather simple, though,
and if you don't get much useful help I'd say it is because you don't
explain it very well.
I believe we've been through this before and your input data is
like this

data = '''
<CsoundSynthesi zer>;
; test.csd - a Csound structured data file

<CsOptions>
-W -d -o tone.wav
</CsOptions>

<CsVersion ;optional section
Before 4.10 ;these two statements check for
After 4.08 ; Csound version 4.09
</CsVersion>

<CsInstrument s>
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
</CsInstruments>

<CsScore>
; originally tone.sco
f1 0 8192 10 1
i1 0 1 20000 1000 ;play one second of one kHz tone
e
</CsScore>

</CsoundSynthesiz er>

Question 1: Is this your input?
if yes:
Question 1.1: What do you want to extract from it? In what format?
if no:
Question 1.1: What is your input?
Question 1.2: What do you want to extract from it? In what format?
Question 2: Do you need to generate output file names from the data?
(One file per instrument?)
if yes:
Question 2.1: What do you want to make your file name from?
(Instrument number?)
Regards

Frederic
I want to pass the file name to the subroutine and return a comment
string if it is there maybe it should be simplier. I probily should
have the option of grabbing the comment in other related routines. I
am pretty ambitious with the main program. I did notice some code in
tcl that would be usefull to the app If I compile it.. I am probily
not ready for that though..

http://www.dexrow.com

Sep 20 '06 #7
Er*********@msn .com wrote:
Frederic Rentsch wrote:
>Er*********@msn .com wrote:
>>All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from

http://python-forum.org/py/viewtopic.php?t=1703

thanks in advance the hole routine is down below..


Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3.     "takes an .csd input file and grabs instr_number instrument and
  4. creates output_File_Name"
  5.     f = open (input_File_Name , 'r')                #opens file passed
  6. in to read
  7.     f2 = open (output_File_Name, 'w')               #opens file passed
  8. in to write
  9.     instr_yes = 'false'                             #set flag to false
  10.     for line in f:                                  #for through all
  11. the lines
  12.       if "instr" in line:                           #look for instr in
  13. the file
  14.            if instr_yes == 'true':                    #check to see if
  15. this ends the instr block
  16.                break                                #exit the block
  17.            reline = re.line.split('instr', '/d$')     #error probily
  18. split instr and /d (decimal number into parts) $ for end of line
  19.            number = int(reline[1])                  #convert to a
  20. number maybe not important
  21.                 if number == instr_number:            #check to see if
  22. it is the instr passed to function
  23.                 instr_yes = "true":                 #change flag to
  24. true because this is the instr we want
  25.       if instr_yes = "true":                        #start of code to
  26. copy to another file
  27.            f2.write(f.line)                         #write line to
  28. output file
  29.     f.close                                         #close input file
  30.     f2.close


Eric,
From your problem description and your code it is unclear what
exactly it is you want. The task appears to be rather simple, though,
and if you don't get much useful help I'd say it is because you don't
explain it very well.
I believe we've been through this before and your input data is
like this

data = '''
<CsoundSynthesi zer>;
; test.csd - a Csound structured data file

<CsOptions>
-W -d -o tone.wav
</CsOptions>

<CsVersion ;optional section
Before 4.10 ;these two statements check for
After 4.08 ; Csound version 4.09
</CsVersion>

<CsInstrument s>
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
</CsInstruments>

<CsScore>
; originally tone.sco
f1 0 8192 10 1
i1 0 1 20000 1000 ;play one second of one kHz tone
e
</CsScore>

</CsoundSynthesiz er>

Question 1: Is this your input?
if yes:
Question 1.1: What do you want to extract from it? In what format?
if no:
Question 1.1: What is your input?
Question 1.2: What do you want to extract from it? In what format?
Question 2: Do you need to generate output file names from the data?
(One file per instrument?)
if yes:
Question 2.1: What do you want to make your file name from?
(Instrument number?)
Regards

Frederic

I want to pass the file name to the subroutine and return a comment
string if it is there maybe it should be simplier. I probily should
have the option of grabbing the comment in other related routines. I
am pretty ambitious with the main program. I did notice some code in
tcl that would be usefull to the app If I compile it.. I am probily
not ready for that though..

http://www.dexrow.com

Eric,
I'm beginning to enjoy this. I'm sure we'll sort this out in no
time if we proceed methodically. Imagine you are a teacher and I am your
student. This is a quiz. I have to take it and you need to explain to me
the problem you want me to solve. If you don't explain it clearly, I
will not know what I have to do and cannot do the quiz. If you answer my
questions above, your description of the problem will be clear and I can
take the quiz. Okay?

Frederic


Sep 20 '06 #8

Frederic Rentsch wrote:
Er*********@msn .com wrote:
Frederic Rentsch wrote:
Er*********@msn .com wrote:

All I am after realy is to change this

reline = re.line.split(' instr', '/d$')

into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from

http://python-forum.org/py/viewtopic.php?t=1703

thanks in advance the hole routine is down below..


Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3.     "takes an .csd input file and grabs instr_number instrument and
  4. creates output_File_Name"
  5.     f = open (input_File_Name , 'r')                #opens file passed
  6. in to read
  7.     f2 = open (output_File_Name, 'w')               #opens file passed
  8. in to write
  9.     instr_yes = 'false'                             #set flag to false
  10.     for line in f:                                  #for through all
  11. the lines
  12.       if "instr" in line:                           #look for instr in
  13. the file
  14.            if instr_yes == 'true':                    #check to see if
  15. this ends the instr block
  16.                break                                #exit the block
  17.            reline = re.line.split('instr', '/d$')     #error probily
  18. split instr and /d (decimal number into parts) $ for end of line
  19.            number = int(reline[1])                  #convert to a
  20. number maybe not important
  21.                 if number == instr_number:            #check to see if
  22. it is the instr passed to function
  23.                 instr_yes = "true":                 #change flag to
  24. true because this is the instr we want
  25.       if instr_yes = "true":                        #start of code to
  26. copy to another file
  27.            f2.write(f.line)                         #write line to
  28. output file
  29.     f.close                                         #close input file
  30.     f2.close

Eric,
From your problem description and your code it is unclear what
exactly it is you want. The task appears to be rather simple, though,
and if you don't get much useful help I'd say it is because you don't
explain it very well.
I believe we've been through this before and your input data is
like this

data = '''
<CsoundSynthesi zer>;
; test.csd - a Csound structured data file

<CsOptions>
-W -d -o tone.wav
</CsOptions>

<CsVersion ;optional section
Before 4.10 ;these two statements check for
After 4.08 ; Csound version 4.09
</CsVersion>

<CsInstrument s>
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
</CsInstruments>

<CsScore>
; originally tone.sco
f1 0 8192 10 1
i1 0 1 20000 1000 ;play one second of one kHz tone
e
</CsScore>

</CsoundSynthesiz er>

Question 1: Is this your input?
if yes:
Question 1.1: What do you want to extract from it? In what format?
if no:
Question 1.1: What is your input?
Question 1.2: What do you want to extract from it? In what format?
Question 2: Do you need to generate output file names from the data?
(One file per instrument?)
if yes:
Question 2.1: What do you want to make your file name from?
(Instrument number?)
Regards

Frederic
I want to pass the file name to the subroutine and return a comment
string if it is there maybe it should be simplier. I probily should
have the option of grabbing the comment in other related routines. I
am pretty ambitious with the main program. I did notice some code in
tcl that would be usefull to the app If I compile it.. I am probily
not ready for that though..

http://www.dexrow.com

Eric,
I'm beginning to enjoy this. I'm sure we'll sort this out in no
time if we proceed methodically. Imagine you are a teacher and I am your
student. This is a quiz. I have to take it and you need to explain to me
the problem you want me to solve. If you don't explain it clearly, I
will not know what I have to do and cannot do the quiz. If you answer my
questions above, your description of the problem will be clear and I can
take the quiz. Okay?

Frederic

instr 1
a1 oscil p4, p5, 1 ; simple oscillator ; comment is
sometimes here
out a1
endin
I need to know the file I wan't to grab this from I need to grab this
out of the larger file and put it into it's own file, I need to know
what instr the user wants. I need to know what file to put it into and
it would be usefull to have the comment line returned (if any).

I did just get python essential reference 3rd edition.. If there is a
better reference on just the subject I am after I would be glad to grab
it when I get cash again.

Sep 20 '06 #9
Er*********@msn .com wrote:
Frederic Rentsch wrote:
>Er*********@msn .com wrote:
>>Frederic Rentsch wrote:
Er*********@msn .com wrote:
All I am after realy is to change this
>
reline = re.line.split(' instr', '/d$')
>
into something that grabs any line with instr in it take all the
numbers and then grab any comment that may or may not be at the end of
the line starting with ; until the end of the line including white
spaces.. this is a corrected version from
>
http://python-forum.org/py/viewtopic.php?t=1703
>
thanks in advance the hole routine is down below..
>
>
>
>
>
>
Expand|Select|Wrap|Line Numbers
  1. def extractCsdInstrument (input_File_Name, output_File_Name,
  2. instr_number):
  3. >
  4.     "takes an .csd input file and grabs instr_number instrument and
  5. creates output_File_Name"
  6.     f = open (input_File_Name , 'r')                #opens file passed
  7. in to read
  8.     f2 = open (output_File_Name, 'w')               #opens file passed
  9. in to write
  10.     instr_yes = 'false'                             #set flag to false
  11. >
  12.     for line in f:                                  #for through all
  13. the lines
  14.       if "instr" in line:                           #look for instr in
  15. the file
  16.            if instr_yes == 'true':                    #check to see if
  17. this ends the instr block
  18.                break                                #exit the block
  19. >
  20.            reline = re.line.split('instr', '/d$')     #error probily
  21. split instr and /d (decimal number into parts) $ for end of line
  22.            number = int(reline[1])                  #convert to a
  23. number maybe not important
  24.                 if number == instr_number:            #check to see if
  25. it is the instr passed to function
  26.                 instr_yes = "true":                 #change flag to
  27. true because this is the instr we want
  28.       if instr_yes = "true":                        #start of code to
  29. copy to another file
  30.            f2.write(f.line)                         #write line to
  31. output file
  32. >
  33.     f.close                                         #close input file
  34.     f2.close
  35. >
>
>
>
>
Eric,
From your problem description and your code it is unclear what
exactly it is you want. The task appears to be rather simple, though,
and if you don't get much useful help I'd say it is because you don't
explain it very well.
I believe we've been through this before and your input data is
like this

data = '''
<CsoundSynthesi zer>;
; test.csd - a Csound structured data file

<CsOptions>
-W -d -o tone.wav
</CsOptions>

<CsVersion ;optional section
Before 4.10 ;these two statements check for
After 4.08 ; Csound version 4.09
</CsVersion>

<CsInstrument s>
; originally tone.orc
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
a1 oscil p4, p5, 1 ; simple oscillator
out a1
endin
</CsInstruments>

<CsScore>
; originally tone.sco
f1 0 8192 10 1
i1 0 1 20000 1000 ;play one second of one kHz tone
e
</CsScore>

</CsoundSynthesiz er>

Question 1: Is this your input?
if yes:
Question 1.1: What do you want to extract from it? In what format?
if no:
Question 1.1: What is your input?
Question 1.2: What do you want to extract from it? In what format?
Question 2: Do you need to generate output file names from the data?
(One file per instrument?)
if yes:
Question 2.1: What do you want to make your file name from?
(Instrumen t number?)
Regards

Frederic
I want to pass the file name to the subroutine and return a comment
string if it is there maybe it should be simplier. I probily should
have the option of grabbing the comment in other related routines. I
am pretty ambitious with the main program. I did notice some code in
tcl that would be usefull to the app If I compile it.. I am probily
not ready for that though..

http://www.dexrow.com
Eric,
I'm beginning to enjoy this. I'm sure we'll sort this out in no
time if we proceed methodically. Imagine you are a teacher and I am your
student. This is a quiz. I have to take it and you need to explain to me
the problem you want me to solve. If you don't explain it clearly, I
will not know what I have to do and cannot do the quiz. If you answer my
questions above, your description of the problem will be clear and I can
take the quiz. Okay?

Frederic


instr 1
a1 oscil p4, p5, 1 ; simple oscillator ; comment is
sometimes here
out a1
endin
I need to know the file I wan't to grab this from I need to grab this
out of the larger file and put it into it's own file, I need to know
what instr the user wants. I need to know what file to put it into and
it would be usefull to have the comment line returned (if any).

I did just get python essential reference 3rd edition.. If there is a
better reference on just the subject I am after I would be glad to grab
it when I get cash again.

Eric,

Tell us the story. Are you a student? A musician? What are you doing
with these files? Where do you get them from? What for?

Frederic

Sep 21 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1830
by: WindAndWaves | last post by:
Hi Gurus I hope I am going to make sense with this question: I have an html page that I have turned into a php page with a bit of php code above the html (connect to database, massage data a little, mix with html, etc...). Now, I would like to use a function in my php code, as otherwise I have to type the same thing over and over again. With a function, I mean something along of the lines of: function x($string) { return...
1
1656
by: Sebastien GIRAUD | last post by:
Hello, First let say that am french and that i'll try to write the best english i can... I'm a python newbe and have the following problem : I try to create 2 threads in a server program and they seems to block each other. I use something like this : start thread waiting for connexion with : server.threadserver = threading.Thread(target = self.__startserver) then do while 1 : socket, host = accept(...) then start a new thread for each new...
1
1780
by: Ron | last post by:
Is this built into any of the python versions? Need it! Using 2.3.5 and doesn't seem to have it.Newbe needs help!email ron@nac.net Thanks Ron
7
1886
by: Jean Pierre Daviau | last post by:
Hi, <script language="javascript" type="text/javascript"> if(navigator.appName.indexOf("Netscape") != -1){ document.writeln('<link rel="stylesheet" href="~styles/aquarelle_ns.css" type="text/css" media="screen" title="base" />'); }else{ document.write('<link rel="stylesheet" href="~styles/aquarelle.css" type="text/css" media="screen" title="base" />'); }
9
6685
by: Yaro | last post by:
Hello DB2/NT 8.1.3 Sorry for stupid questions. I am newbe in DB2. 1. How can I read *.sql script (with table and function definitions) into a database? Tool, command... 2. In Project Center I created funcion CREATE FUNCTION DB2ADMIN.xxx( )
1
2015
by: Jim | last post by:
I have created a windows form that contains several tab pages which contain a panels. On a tab page I am trying to dynamically create a series of buttons in that pages panel. I am failing because I can not find the proper way to point to the specific tab page and its panel when creating the buttons. I also need to dynamically change the background color property of each button as it is clicked.
6
1488
by: ken | last post by:
Hi all, I copied this code from the examples. "How to: Receive Strings From Serial Ports in Visual Basic" When I call the function and using the single step method it hangs at Dim Incoming As String = com1.ReadLine(). I don't have anything connect to Comm1. Does anyone know why this is happening? Thanks for the help. Regards, Ken Function ReceiveSerialData() As String ' Receive strings from a serial port.
19
1544
by: AMP | last post by:
I have a simple question. If i have a button on form1 that creates : Form2 newform = new Form2(); newform.Show(); As I click the button a new form shows,but acording to my code each one has the same name.Are they really there(I can move them around and close them).If they are how do they have the same name (to refer to in code).
17
2709
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not pattern1 print >>orcfilename, line I am pretty sure my code isn't close to what I want. I need to be able
0
8666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9010
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8853
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
1992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.