摘要:
from lxml import etree html = ''' <li class="tag_1">需要的内容1 <a>需要的内容2</a> </li> ''' selector = etree.HTML(html) contents = selector.xpath('//li[@class 阅读全文
posted @ 2020-02-11 23:19
Caper123
阅读(1082)
评论(0)
推荐(0)
摘要:
import requests from lxml import etree import time, json, requests import pymysql header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) 阅读全文
posted @ 2020-02-11 23:13
Caper123
阅读(331)
评论(0)
推荐(0)
摘要:
利用split进行分割 f=open("output.txt","r", encoding = 'utf-8',errors='ignore') for line in f: print(line.split(' ')[0]) 原文件: 效果: 阅读全文
posted @ 2020-02-11 19:50
Caper123
阅读(5701)
评论(0)
推荐(0)

浙公网安备 33010602011771号