08 2017 档案

re.compile
摘要:详情见>>> import re >>> s = "adfad asdfasdf asdfas asdfawef asd adsfas " >>> reObj1 = re.compile('((\w+)\s+\w+)') >>> reObj1.findall(s) [('adfad asdfasdf', 'adfad'), ('asdfas asdfawef', 'asdfas'), ('as... 阅读全文

posted @ 2017-08-25 13:06 TMatrix52 阅读(149) 评论(0) 推荐(0) 编辑

Python urllib.quote
摘要:转:编码:urllib.quote(string[, safe]),除了三个符号“_.-”外,将所有符号编码,后面的参数safe是不编码的字符, 使用的时候如果不设置的话,会将斜杠,冒号,等号,问号都给编码了。 如下: >>> import urllib >>> print urllib.quote("http://neeao.com/index.php?id=1") http%3A//n... 阅读全文

posted @ 2017-08-23 19:41 TMatrix52 阅读(591) 评论(0) 推荐(0) 编辑

Shell #*/ 和 %/*
摘要:#!/bin/bash i="this/is/a/path.config" name=${i#*/} path=${i%/*} echo $name echo $path is/a/path.config this/is/a 阅读全文

posted @ 2017-08-23 15:08 TMatrix52 阅读(360) 评论(0) 推荐(0) 编辑

[转载] python必碰到的问题---encode与decode,中文乱码
摘要:阅读来源: 字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。 decode的作用是将其他编码的字符串转换成unicode编码 阅读全文

posted @ 2017-08-23 14:23 TMatrix52 阅读(128) 评论(0) 推荐(0) 编辑

Python爬虫利器三之lxml库以及Xpath语法
摘要:转自 阅读全文

posted @ 2017-08-08 11:39 TMatrix52 阅读(101) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示