Python提供的( )模块可以实现正则表达式操作所需要的功能。
A. re
B. os
C. random
D. sys
查看答案
采用re模块中的( )方法,可以将字符串数据类型的正则表达式编译为正则表达式对象。
A. re.split
B. re.sub
C. re.compile
D. re.finditer
匹配对象提供( )方法用于返回一个元组,包含所有匹配的子组。
A. match.group
B. match.groupdict
C. match.groups
D. match.tuple
re.split('(\W+)', 'abc, abc,defg')结果是( )。
A. ['abc', ',', 'abc', ',', 'defg']
B. ('abc', ',', 'abc', ',', 'defg')
C. ['abc', 'abc', 'defg']
D. ('abc', 'abc', 'defg')
以下程序的执行结果是( )。text = "failure is the price of success, 666."print(re.sub('\s+','-',text))
A. failure-is-the-price-of-success,666.
B. failure-is-the-price-of-success,-666.
C. failure is the price of success,-666.
D. failure is the price of success, 666.