一、实现效果
1. python代码
import requests
from lxml import etree
import re
import tkinter as tk
from PIL import Image, ImageTk
from xpinyin import Pinyin
def get_image(file_nam, width, height):
im = Image.open(file_nam).resize((width, height))
return I
下载8000首儿歌的python的代码:
复制代码 代码如下:
#-*- coding: UTF-8 -*-
from pyquery import PyQuery as py
from lxml import etree
import urllib
import re
import os
import sys
import logging
def format(filename):
tuple=(‘ ‘,”’,’\”)
for char in tuple:
if
小试牛刀,剪短的代码爬取李白200首诗歌,并整齐的保存到txt文档中,代码如下:
import requests
from lxml import etree
n = 0
for i in range(10):
if i==0:
url="http://www.shicimingju.com/chaxun/zuozhe/1.html"
else:
url=="http://www.shicimingju.com/chaxun/zuozhe/"+"1
版本信息:
python 2.7.12
lxml 3.8.0
from lxml import etree
html_str =
this from blog.csdn.net/lncxydjq , DO NOT COPY!
*****
html = etree.HTML(html_str)
print html.xpath('//div[id=box1]/div/node()')[1]
print type(h