Chris Hengge wrote:
> Not sure if you were challenging me to think, or asking me, but I was
> wanting to "line" to be printed... as in the string from the list.
> What I got with re was what I'm assuming was a memory address.
What you got was an object. If you try to print an object, all you get
Not sure if you were challenging me to think, or asking me, but I was wanting to "line" to be printed... as in the string from the list. What I got with re was what I'm assuming was a memory address.
On 10/17/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> I remove those lines, but I was trying to use>
> I remove those lines, but I was trying to use
> for line in contents:
> result = re.search("something", line)
> print result
'result' here is going to either be None, as you've seen, or a "match"
object. We have several options available to use once we have a
match. Take a look at a fe
On 18/10/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> I remove those lines, but I was trying to use
> for line in contents:
> result = re.search("something", line)
> print result
>
> this printed out something like
>
> None
> None
> None
> hex memory address of goodness
> None
> None
If y
An article at devshed was using it like that... but the output wasn't what I was looking for.. I was getting the hex address where the result was, but not printing the line.. I think the simple code you recommended in your first reply will do the trick, I'm not looking for anything magical, just ne
Chris Hengge wrote:
> I remove those lines, but I was trying to use
> for line in contents:
> result = re.search("something", line)
> print result
I'm pretty sure this isn't how you use regular expressions.
I have to go to class right now but if no one else has replied when I
get back I'll
I remove those lines, but I was trying to usefor line in contents: result = re.search("something", line) print resultthis printed out something like NoneNoneNonehex memory address of goodness
NoneNone...On 10/17/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
Chris Hengge wrote:> contents =
Chris Hengge wrote:
> contents = readlines(myfile, 'r')
> Ok, I'm under the impression this is a list of strings (array)
Nope. No such thing as arrays in Python.
It is a list of strings, that's it. :)
> How in the world do I cycle through them looking for words?
>
> for line in contents:
> if
contents = readlines(myfile, 'r')Ok, I'm under the impression this is a list of strings (array)How in the world do I cycle through them looking for words?for line in contents: if line.contains("something")
print lineThats a mock up of what I'm looking for. I tried to figure out how to