123456789101112131415161718192021222324252627282930 |
- # -*- coding:utf-8 -*-
- import re,random
- def IsChineseCharInside(sentence):
- for uchar in sentence:
- if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
- return True
- return False
- def isMatchRegExp(param,rule):
- if param == None or param == "":
- return True
- isRegular = False
- try:
- for word in param:
- matchObj = re.search(word,rule, re.M | re.I | re.S)
- if matchObj:
- isRegular = True
- else:
- return False
- return isRegular
- except Exception as err:
- return False
- def getRamdomNumber(size):
- str = ""
- for i in range(6):
- ch = chr(random.randrange(ord('0'), ord('9') + 1))
- str += ch
- return str
|