hi there, i got a problem with Tupel and the find() function. I know in the document are this Keywords which i am looking for but find() always returns -1.
Thanks for the help. fedora_user ------------------------------------------------------------------------ <code> #!/usr/bin/python # -*- coding: utf_8 -*- import string import sys import os import urllib anf_bez = ('Startpreis:','Restzeit:','Angebotsbeginn:','Übersicht:','Artikelstandort:','Versand nach:', 'Artikelnummer:','Kategorie') end_bez = ('</tr>','MESZ','MESZ','Gebote','</tr>','</tr>','</td>','</tr>') # Artikelnummer von dem die Infos gespeichert werden artikelno = `sys.argv[1:2]` artikelno = artikelno[2:-2] if len(artikelno) != 0: TARGET_DIR = "/opt/internet/eBay/" EBAY_HTTP = "http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=" EBAY_PAGE = EBAY_HTTP + artikelno SAVE_PAGE = "" SAVE_PAGE = SAVE_PAGE + "eBay-artikel" + artikelno + ".html" SAVE_PAGE = os.path.join(TARGET_DIR,SAVE_PAGE) # webSite laden und speichern urllib.urlretrieve(EBAY_PAGE,SAVE_PAGE) # webSite öffnen und absuchen file = open(SAVE_PAGE,"rt") for a in file: asi = 0 # Suchindex für 'anf_bez' esi = 0 # Suchindex für 'end_bez' while asi < 8: anf = -1 end = -1 anf = a.find( anf_bez[asi] ) # <------------ always returns -1, never find anything ????? ----------------- if anf != -1: end = a[anf].find( end_bez[esi] ) if end != -1: print a[anf:end] asi = asi+1 esi = esi+1 print asi,esi print EBAY_PAGE print SAVE_PAGE else: print "Artikelnummer als Argument übergeben." </code> ------------------------------------------------------------------------ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor