题目内容

写出下面程序的运行结果。import repattern=re.compile(r'Student', re.I) #生成正则表达式对象r1=pattern.match('Students study programming')r2=pattern.match('I am a student!',3)r3=pattern.match('I am a student!',7)r4=re.search(r'Student','I am a student',re.I)r5=re.match(r'Student','I am a student',re.I)print(r1)print(r2)print(r3)print(r4)print(r5)

查看答案
更多问题

写出下面程序的运行结果。import restr='''sno:#1810101#,name:#李晓明#,age:#19#,major:#计算机#sno:#1810102#,name:#马红#,age:#20#,major:#数学#'''rlt=re.search(r'sno:#([\s\S]*?)#[\s\S]*?major:#([\s\S]*?)#', str, re.I)if rlt: #判断是否有匹配结果print('匹配到的整个字符串:', rlt.group())print('sno:%s, startpos:%d, endpos:%d'%(rlt.group(1), rlt.start(1), rlt.end(1)))print('major:%s, startpos:%d, endpos:%d'%(rlt.group(2), rlt.start(2), rlt.end(2)))print('所有分组匹配结果:', rlt.groups())else:print('未找到匹配信息')

写出下面程序的运行结果。import rehtml='''%abc%%def%python(ghi)'''content=re.sub(r'%[\s\S]*%', '&', html)content=content.strip()print('替换之后的内容为: ', content)content2=re.subn(r'%[\s\S]*%', '&', html)print('替换之后的内容及替换次数为: ', content2)

_________ organizations are only online.

A. Brick-and-mortar
Brick-and-click
Clicks-and-mortar
D. Virtual

You are a musician. You only sell your songs on iTunes. This is an example of a _________ business.

A. brick-and-mortar
B. brick-and-click
C. clicks-and-mortar
D. virtual

答案查题题库