
08.01.2010, 15:03
|
|
Постоянный
Регистрация: 12.06.2008
Сообщений: 654
С нами:
9427413
Репутация:
973
|
|
Сообщение от Ice_VeNOm
Код:
def bash():
res = urllib.request.urlopen('http://bash.org.ru/random')
res= str(res.read())
s=re.search(r"<div>(.*?)<\/div>",res)
for x in s.groups():
print(x.decode('cp1251'))
Как сделать, чтобы выводил русский текст?
python v. 3.1
В 3.1. по-другому нужно
попробуй так.
Код:
res = urllib.request.urlopen('http://bash.org.ru/random')
res= res.read()
s=re.search(r"<div>(.*?)<\/div>",res)
for x in s.groups():
print(x.decode('cp1251').encode("cp866"))
|
|
|