Author Topic: [py] index() and find() not working????  (Read 876 times)

0 Members and 1 Guest are viewing this topic.

Offline hmm

  • Serf
  • *
  • Posts: 23
  • Cookies: 0
    • View Profile
[py] index() and find() not working????
« on: 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.


Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [py] index() and find() not working????
« Reply #1 on: 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.
>>>import this
-----------------------------

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [py] index() and find() not working????
« Reply #2 on: 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.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [py] index() and find() not working????
« Reply #3 on: June 02, 2012, 09:53:02 pm »
Yeah, there is this thing called The CODE tags, right? or just the pastebin, mmk?

Offline hmm

  • Serf
  • *
  • Posts: 23
  • Cookies: 0
    • View Profile
Re: [py] index() and find() not working????
« Reply #4 on: June 03, 2012, 10:45:43 pm »
updated. with code tags.