positive: "版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。<br>版权<br>python专栏收录该内容<br>11 篇文章0 订阅<br>订阅专栏<br>判断字符串相等使用==,不使用is和cmp()函数<br>cmp() 函数则是相当于但是在 Python3 中,cmp() 函数被移除了,所以我以后还是避免少用这个函数。#-*-conding:utf-8-*- i='新闻'; m=input();if i==m:print('yes');else:print('no');input();if second_company_name== u'中外运长航'or second_company_name== u'长航集团':print(u'忽略中外运长航和长航集团的子公司')continue<br>在if 判断语句中非常有用呐!<br>#!/usr/bin/python# Filename: if.py number=23 guess=int(raw_input('Enter an integer : '))if guess== number:print'Congratulations, you guessed it.'# New block starts hereprint""(but you do not win any prizes!)""# New block ends hereelif guess"
negative: "'正则<br>Function RegExp(text As String, reg As String) As String<br>Dim mRegExp As Object '正则表达式对象<br>Dim mMatches As Object '匹配字符串集合对象<br>Dim mMatch As Object '匹配字符串<br>RegExp = """"<br>Set mRegExp = CreateObject(""Vbscript.Regexp"")<br>With mRegExp<br>.Global = True 'True表示匹配所有, False表示仅匹配第一个符合项<br>.IgnoreCase = True 'True表示不区分大小写, False表示区分大小写<br>.Pattern = reg '匹配字符模式 "".*[款].*[号][\d]+[、](.*)""<br>SetmMatches = .Execute(text) '执行正则查找,返回所有匹配结果的集合,若未找到,则为空<br>For Each mMatch In mMatches<br>If (Not mMatch.SubMatches(0) = """") Then<br>RegExp = Trim(mMatch.SubMatches(0))<br>End If<br>Next<br>End With<br>Set mRegExp = Nothing<br>Set mMatches = Nothing<br>End Function"