123456789101112131415161718192021222324252627282930313233 |
- # -*- coding:utf-8 -*-
- import re, random
- def IsChineseCharInside(sentence):
- for uchar in sentence:
- if u'\u4e00' <= uchar <= u'\u9fa5':
- return True
- return False
- def isMatchRegExp(param, rule):
- if param is 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(size):
- ch = chr(random.randrange(ord('0'), ord('9') + 1))
- str += ch
- return str
|