Login Register






ValueError filter_list
Author
Message
ValueError #1
I'm working on a top secret project in Python that requires I grab the whois list from SL.

I feel retarded for asking, but can anyone help?

Code:
import urllib,sys if sys.version_info[0] > 2: import urllib.request as urlreq else: import urllib2 as urlreq w = urlreq.urlopen('https://www.sinister.ly/') xread = str(w.read()) if "fuck you bill bergenstein" in xread: whosonline = "What the fuck?" else: (t,c) = xread.split("""<tr><td class="trow1"><span class="smalltext">""",1) (c,t) = c.split("""</span></td></tr>""",1) whosonline = c print(whosonline)
[Image: BXqGARG.png]

Reply

RE: ValueError #2
And what is the error, good sir?

Reply

RE: ValueError #3
(03-07-2014, 07:02 AM)w00t Wrote: And what is the error, good sir?

Needs more than 1 value to unpack.
[Image: BXqGARG.png]

Reply

RE: ValueError #4
For whatever reason, split isn't returning a list.

It may have something to do with that you restricted it to output only one string.

Just a guess though.

Reply

RE: ValueError #5
The error is happening because there is no place to split, here is the test code, you'll see it can't find your string in the page source

Code:
import urllib,sys if sys.version_info[0] > 2: import urllib.request as urlreq else: import urllib2 as urlreq w = urlreq.urlopen('https://www.sinister.ly/') xread = str(w.read()) splitvalue = """<tr><td class="trow1"><span class="smalltext">""" print(splitvalue) if(splitvalue in xread): print("I found a place to split!") else: print("There is nowhere to split! :(") if "fuck you bill bergenstein" in xread: whosonline = "What the fuck?" else: allsplits = xread.split(splitvalue) for part in allsplits: print("Got a part") (t,c) = allsplits (c,t) = c.split("""</span></td></tr>""",1) whosonline = c print(whosonline)
[Image: jWSyE88.png]

Reply