200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > python使用正则表达式判别字符串是否以一个大写字符起始而跟随了一些小写字符

python使用正则表达式判别字符串是否以一个大写字符起始而跟随了一些小写字符

时间:2024-01-12 15:38:20

相关推荐

python使用正则表达式判别字符串是否以一个大写字符起始而跟随了一些小写字符

python使用正则表达式判别字符串是否以一个大写字符起始而跟随了一些小写字符

#

# Python3 code to find sequences of one upper# case letter followed by lower case lettersimport re# Function to match the stringdef match(text):# regexpattern = '[A-Z]+[a-z]+$'# searching patternif re.search(pattern, text):return('Yes')else:return('No')# Driver Functionprint(match("Darling"))print(match("okseseesee"))print(match("Bravo"))print(match("B"))

YesNoYesNo

参考:Python regex to find sequences of one upper case letter followed by lower case letters

参考:Python find sequences of one upper case letter followed by lower case letters

参考:python re

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。