Avoid this out of index error?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karuption
    New Member
    • Jun 2010
    • 1

    Avoid this out of index error?

    ok i was scrapping a page and this function gives me an error in my IRC bot...
    Code:
    t = data.split(':!time ')[1]#data = irc feed
        file = urllib2.urlopen('http://www.timeanddate.com/worldclock/')
        html = file.read()
        html = html.split('<body>')[1]
        html = html.split('</span>')[2]
        html = html.split('<span')[0]
        tp = html.split(t)[1]
    help?
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    At what point in your code does the error occur? Have you tried print statements to see what the status of each variable is? What is the value of "t"?

    BTW - Your indentation is wrong in the posted code.

    Comment

    Working...