Hi All,
How do I parse a variable inside an RE?
What is the re.search() syntax when your
search string is a variable?
It's easy to parse hardcoded RE's but not
if you use a variable.
Here is my code, input and runtime:
$ cat test45.py
#!/usr/bin/python
import re
resp = raw_input('Selection:
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python tutorials.
Here is the code, test43.in, and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
print item: , item,
if item == var:
print
Hi All,
I dont understand why the following code cannot find the
variable tree. It is very simple but I could not find the answer
to this on the Python Tutorials. Here is the code, input and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
print item: ,
You may like to read this: http://www.amk.ca/python/howto/regex/
This is a good resource. Thank you.
Someone else pointed out that I needed to change the
if reCheck == None:
to
if reCheck == None: # removed the s
This worked great! Thanks!
--JM
--
On Jun 26, 5:12 pm, John Machin [EMAIL PROTECTED] wrote:
On Jun 27, 10:01 am, [EMAIL PROTECTED] wrote:
You may like to read this:http://www.amk.ca/python/howto/regex/
This is a good resource. Thank you.
Someone else pointed out that I needed to change the
if reCheck == None:
to
Hi All,
How do I format printed data in python?
I could not find this in the Python Reference Manual:
http://docs.python.org/ref/print.html
Nor could I find it in Matloff's great tutorial:
http://heather.cs.ucdavis.edu/~matloff/Python/PythonIntro.pdf
For example, how do I turn this:
512 Jun 5