上一页 1 ··· 89 90 91 92 93 94 95 96 97 ··· 106 下一页
摘要: #include #include #include #include using namespace std; typedef struct { int a,b; double v; }node; typedef struct { int a,b; }P; const int maxn=109; double ans; int father[maxn]; nod... 阅读全文
posted @ 2018-08-08 14:46 小学弟- 阅读(92) 评论(0) 推荐(0) 编辑
摘要: HDU 1233(最小生成树 模板) #include #include #include using namespace std; typedef struct { int a,b; int v; }node; const int maxn=105; int ans; int father[maxn]; node graph[maxn*(maxn-1)/2]; int ... 阅读全文
posted @ 2018-08-08 12:51 小学弟- 阅读(90) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3278 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define maxn 1... 阅读全文
posted @ 2018-08-08 11:17 小学弟- 阅读(92) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2386 #include #include using namespace std; const int MAX = 10000; char Map[MAX][MAX]; int N,M; int d[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}}; bool... 阅读全文
posted @ 2018-08-08 11:16 小学弟- 阅读(125) 评论(0) 推荐(0) 编辑
摘要: re模块 准备: flags有很多可选值: re.I(IGNORECASE)忽略大小写,括号内是完整的写法 re.M(MULTILINE)多行模式,改变^和$的行为 re.S(DOTALL)点可以匹配任意字符,包括换行符 re.L(LOCALE)做本地化识别的匹配,表示特殊字符集 \w, \W, \b, \B, \s, \S 依赖于当前环境,不推荐使用 re.U(UNICODE) 使用\w ... 阅读全文
posted @ 2018-08-07 17:17 小学弟- 阅读(426) 评论(0) 推荐(0) 编辑
摘要: 在python中使用正则表达式 1.转义符 正则表达式中的转义: '\('表示匹配小括号 [()+*/?&.] 在字符组中一些特殊的字符会现出原形 所有的\s\d\w\S\D\W\n\t都表示他原本的意义 [-]只有写在字符组的首位的时候表示普通的减号 写在其它位置的时候表示范文[1-9]如果就是想匹配减号[1\-9] Python中的转义符 分析过程: '\n'#\是转义符 赋予这个n一个... 阅读全文
posted @ 2018-08-07 17:16 小学弟- 阅读(1423) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2018-08-07 14:19 小学弟- 阅读(236) 评论(0) 推荐(0) 编辑
摘要: import requests from requests.exceptions import RequestException import re import json # 获取TOP100榜页面的URL def get_url_links(): base_url = 'http://maoyan.com/board/4?offset=' list_url = [] ... 阅读全文
posted @ 2018-08-06 23:20 小学弟- 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 本质:导入模块的本质就是把python文件解释一遍, 导入包的本质就是把包文件下面的init.py文件运行一遍。 1)同目录下模块的导入 #同级目录下模块的导入 import module_name #直接导入模块 import module1_name,module2_nam... 阅读全文
posted @ 2018-08-06 15:51 小学弟- 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 正则表达式 what:一种匹配字符串的规则 where:程序领域:1,登录注册的表单验证 2.爬虫 3.自动化开发 why:可以制定一个规则 1.来确认某一个字符串是否符合规则 2.从大段的字符串中找到符合规则的内容 how: 正则表达式的语法:1.元字符 2.量词 3.特殊用法和现象 1元字符 [...]----匹配字符组(集)中的字符 [^...]---匹配除了字符组中字符的所有字符... 阅读全文
posted @ 2018-08-06 15:32 小学弟- 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 ··· 89 90 91 92 93 94 95 96 97 ··· 106 下一页