1、首先打开python,输入coding:utf-8importurllib,urllib2importTkinter。
2、然后输入ytm等于Tk,创建Tk对象ytmtitle,输入内容。
python⾥使⽤正则表达式的句号和星号当我们想在正则表达式⾥某个位置上只匹配⼀个任意的字符时,可以使⽤句号(.)来实现,星号(*)是表0个或多个字符重复,例⼦如下:
#python 3.6
#蔡军⽣
#http://blog.csdn.net/caimouse/article/details/51749579
#
from re_test_patterns import test_patterns
test_patterns(
'abbaabbba',
[('a.', 'a followed by any one character'),
('b.', 'b followed by any one character'),
('a.*b', 'a followed by anything, ending in b'),
('a.*?b', 'a followed by anything, ending in b')],
)
结果输出如下:
'a.' (a followed by any one character)
'abbaabbba'
'ab'
...'aa'
'b.' (b followed by any one character)
'abbaabbba'
.'bb'
.....'bb'
.......'ba'
'a.*b' (a followed by anything, ending in b)
'abbaabbba'
'abbaabbb'
'a.*?b' (a followed by anything, ending in b)
'abbaabbba'
'ab'
...'aab'
在这⾥采⽤?来取消贪婪模式。
深⼊浅出Numpy
Python游戏开发⼊门
你也能动⼿修改C编译器
纸牌游戏开发
五⼦棋游戏开发
RPG游戏从⼊门到精通
WiX安装⼯具的使⽤
俄罗斯⽅块游戏开发
boost库⼊门基础
Arduino⼊门基础
Unity5.x游戏基础⼊门
TensorFlow API攻略
TensorFlow⼊门基本教程
C++标准模板库从⼊门到精通
跟⽼菜鸟学C++
跟⽼菜鸟学python
在VC2015⾥学会使⽤tinyxml库
在Windows下SVN的版本管理与实战Visual Studio 2015开发C++程序的基本使⽤在VC2015⾥使⽤protobuf协议
在VC2015⾥学会使⽤MySQL数据库
¥
5
百度文库VIP限时优惠现在开通,立享6亿+VIP内容
立即获取
python里使用正则表达式的句号和星号
python⾥使⽤正则表达式的句号和星号
当我们想在正则表达式⾥某个位置上只匹配⼀个任意的字符时,可以使⽤句号(.)来实现,星号(*)是表0个或多个字符重复,例⼦如下:
#python 3.6
#蔡军⽣
#http://blog.csdn.net/caimouse/article/details/51749579
#
from re_test_patterns import test_patterns
第 1 页
test_patterns(
'abbaabbba',
[('a.', 'a followed by any one character'),
('b.', 'b followed by any one character'),
('a.*b', 'a followed by anything, ending in b'),
('a.*?b', 'a followed by anything, ending in b')],
)
结果输出如下: