Hi, I'm a Garfield fan and I thought that I'd make a program that would enable me to read the online comics without opening firefox and typing the url and waiting for all the other junk to load. Here's my code:
# import modules import time import urllib2 class data: # Define time and date todays_date = time.localtime(time.time()) dayNum = time.strftime("%d", todays_date) monthNum = time.strftime("%m", todays_date) yearNum = time.strftime("%y", todays_date) yearNumFull = time.strftime("%Y", todays_date) # Define url and it's components stripName ="http://images.ucomics.com/comics/ga/%s/ga" % (yearNumFull) c_strip = "%s%s%s%s.gif" % (stripName, yearNum, monthNum, dayNum) f = "" # Other info c_strip_download = "Downloading Today's Garfield..." # Errors urllib2_URLError = """Temporary failure in name resolution. This means that you may not be online or the site is down. You may want to try again later.""" # Enough defining lets get our hands dirty. try: data.f = urllib2.urlopen(data.c_strip) except urllib2.URLError: print urllib2_URLError data.f.save("%s%s%s.gif" % (data.yearNum, data.monthNum, data.dayNum)) data.f.get() I would like to know how to save the image to the computer's hard drive. Is it something like f.save("%s%s%s.gif" % (yearNum, monthNum, dayNum)) ? thanks, Joseph _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor