0
点赞
收藏
分享

微信扫一扫

Python的私有变量


1.Python中的实例不可以访问类的私有变量

'''Python正则实例'''
import re

c=re.match("www","www.baidu.com") #在起始位置匹配

print(c.span())

d=re.match("com","www.baidu.com") #不在起始位置匹配

print(d)


lines="Cat are small than dogs"
d=re.match(r"(.*)are (.*?) .*",lines, re.I|re.M) #只有有括号的情况,才可以使用group()里面加数字才有效用
print(d.group(2))

举报

相关推荐

0 条评论