[Tutor] Code runs in interpreter but won't output to stdout
scurvy scott
stopitscurvy at gmail.com
Wed Jan 29 03:12:28 CET 2014
Hi guys, I'm trying to figure out why my code won't output to terminal, but
will run just fine in interpreter.
I'm using python 2.7.3 on Debian Linux/Crunchbang.
Here is my code.
import requests
from bs4 import BeautifulSoup as beautiful
import sys
def dogeScrape(username, password):
payload = {'username': username, 'password': password}
r = requests.post("http://dogehouse.org/index.php?page=login",
data=payload)
soup = beautiful(r.text)
confirmed = str(soup.findAll('span',{'class':'confirmed'}))
print "Confirmed account balance: " + confirmed[86:98]
dogeScrape("XXXX", "XXXX")
It will output the "confirmed....." part, just not the confirmed variable.
It will output the entire thing in the interpreter.
I initially ran this without being in a function with the username/password
stuff hardcoded to see if the rest of the scraper would run, it still never
output to stdout.
Any help would be appreciated.
Also, as an aside, is there a terminal/command line parsing library someone
could recommend? I've been looking at optparse but maybe some of you will
have other ideas.
thanks a lot,
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140128/d25a3f93/attachment.html>
More information about the Tutor
mailing list