Ascii codec can't encode
luca72
lucaberto at libero.it
Thu Oct 30 06:01:07 EDT 2008
Hello Again
the code is this
# -*- coding: ISO-8859-1 -*-
from BeautifulSoup import BeautifulSoup
import urllib
sito = urllib.urlopen('http://text.net/')
esamino = BeautifulSoup(sito)
luca = esamino.findAll('tr', align='center')
lunghezza = len(luca)
messaggio_per_scar = open('me', 'wb')
file_ricerca = open('ri', 'wb')
for dati in range(lunghezza):
gino = luca[dati]
test = gino.findAll(text=True)
print test
valori_a = gino.find("a")["onclick"].split("'")
print valori_a
nome_boot = valori_a[1]
print nome_boot
frase_scar = '/msg '+nome_boot+' xdcc send '+test[0]+'\n\r'
messaggio_per_scar.write(frase_scar)
nome = test[2]
if nome ==' ':
nome = test[4]
frase_ric = nome+' '+test[1]+' '+test[0]+'\n\r'
file_ricerca.write(frase_ric) #here i have the error
messaggio_per_scar.close()
file_ricerca.close()
Regards
Luca
More information about the Python-list
mailing list