本文整理匯總了Python中permutation.Permutation.permutationList方法的典型用法代碼示例。如果您正苦於以下問題:Python Permutation.permutationList方法的具體用法?Python Permutation.permutationList怎麽用?Python Permutation.permutationList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類permutation.Permutation
的用法示例。
在下文中一共展示了Permutation.permutationList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: generateBirthDayList
# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import permutationList [as 別名]
def generateBirthDayList(yearStr, monthStr, dayStr):
#以1949-10-01為例
yearStr = str(yearStr)
monthStr = "%02d" % (int(monthStr))
dayStr = "%02d" % (int(dayStr))
birthDayList = []
birthDayList.append(yearStr)
birthDayList.append(monthStr)
birthDayList.append(dayStr)
obj = Permutation()
obj.words = birthDayList
variables.birthday.extend(obj.permutationList())
#隻有月份和日期的全序列 10-01
birthDayList.remove(yearStr)
obj = Permutation()
obj.words = birthDayList
variables.birthday.extend(obj.permutationList())
birthDayList.append(yearStr)
#日期以單位數的全序列 1949-10-1
if re.match(r"0\d", monthStr) or re.match(r"0\d", dayStr):
birthDayList.remove(monthStr)
birthDayList.append(str(int(monthStr)))
birthDayList.remove(dayStr)
birthDayList.append(str(int(dayStr)))
obj.words = birthDayList
variables.birthday.extend(obj.permutationList())
#日期以單位數,沒有年份的全序列 10-1
birthDayList.remove(yearStr)
obj = Permutation()
obj.words = birthDayList
variables.birthday.extend(obj.permutationList())
birthDayList.append(yearStr)
#年份是兩位數的全序列 49-10-1
if len(yearStr) == 4:
sYear = yearStr[2:4]
generateBirthDayList(sYear, monthStr, dayStr)
示例2: afterGenerateNameList
# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import permutationList [as 別名]
def afterGenerateNameList(f, l):
nameList = []
nameList.append(f)
nameList.append(l)
obj = Permutation()
obj.words = nameList
rst = obj.permutationList()
if rst:
variables.name.extend(rst)
#字符串去重
variables.name = list(set(variables.name))
示例3: doGenerate
# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import permutationList [as 別名]
def doGenerate():
variables.head = handleList(variables.head)
variables.tail = handleList(variables.tail)
variables.name.append("")
variables.birthday.append("")
variables.extinfo.append("")
variables.dict_max.append("")
variables.tail.append("")
variables.head.append("")
variables.year.append("")
# variables.lett.append("")
variables.email.append("")
variables.qq.append("")
variables.phoneNumer.append("")
f = open('./result.txt', 'w')
for birstdayItem in variables.birthday:
for nameItem in variables.name:
for extinfoItem in variables.extinfo:
for dictMaxItem in variables.dict_max:
for yearItem in variables.year:
for phoneItem in variables.phoneNumer:
for qqItem in variables.qq:
for emailItem in variables.email:
preS = birstdayItem + nameItem + extinfoItem\
+ dictMaxItem + yearItem + phoneItem\
+ qqItem + emailItem
if len(preS) < variables.minLen or len(preS) > variables.maxLen:
continue
obj = Permutation()
obj.words = [birstdayItem, nameItem, extinfoItem, \
dictMaxItem, \
yearItem, phoneItem, qqItem, \
emailItem]
obj.words = handleList(obj.words)
rst = obj.permutationList()
for s in rst:
if len(s) < variables.minLen or len(s) > variables.maxLen:
break
for tailItem in variables.tail:
for headItem in variables.head:
s2 = headItem + s + tailItem
if len(s2) >= variables.minLen and len(s2) <= variables.maxLen:
print s2
if const.isRelease:
f.write(s2);
f.write('\n')
f.close()
print "Done!"