EvilZone

Programming and Scripting => Scripting Languages => : hmm June 02, 2012, 01:35:29 AM

: [py] index() and find() not working????
: hmm June 02, 2012, 01:35:29 AM
well, I have run into a strange issue. the gist of my code goes as follows:
1. go to specific page.
2. get some links and tittles
3. go to the first links page, i.e(  page = urlopen(links).read()   )
4. not attempt to find a tag in that page, i.e (  index=page.find('<div class="blah_di_blah">')  )


if I throw a print after 3, the source prints. So why is 4 failing to return any index aside from -1.


ps. I looked to the tag in the source and all that jazz, no typos, definite match, ect...
The only thing I could possible think of is that page is somehow not a string? But I do not know how that could be? Any help would be appreciated.

: Re: [py] index() and find() not working????
: techb June 02, 2012, 03:36:02 AM
Could we see the code? We can't help without seeing it, none of use are psychic, well Ande might be, but the rest of us aren't lol.
: Re: [py] index() and find() not working????
: Kulverstukas June 02, 2012, 09:41:39 AM
Yes, include the full code. If you don't want to then at least a portion of it...
So I guess you are using plaintext search as I see from the example? why not regex? it would much easier with regex.
: Re: [py] index() and find() not working????
: Kulverstukas June 02, 2012, 09:53:02 PM
Yeah, there is this thing called The CODE tags, right? or just the pastebin, mmk?
: Re: [py] index() and find() not working????
: hmm June 03, 2012, 10:45:43 PM
updated. with code tags.