摘要: try: gender=input('请输入您的性别:') if gender!='男' and gender!='女': #如果输入的不是男或者女,判断为True,那么执行第四刚代码 raise Exception('性别只能是男或女') #抛出异常对象 else: print('您的性别:',g 阅读全文
posted @ 2023-11-29 21:49 坚持坚持再一次坚持 阅读(57) 评论(0) 推荐(0)
摘要: import repattern='\d\.\d+'s='I study 3.114 python every and 2.71 python I love you's2='python I love you'match= re.findall(pattern,s) #findall 函数获取匹配对 阅读全文
posted @ 2023-11-29 21:16 坚持坚持再一次坚持 阅读(85) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2023-11-29 21:11 坚持坚持再一次坚持 阅读(14) 评论(0) 推荐(0)