模块,

怎么调用模块的方法,
不用from module import * 直接

import module



from sayhello import logger,name

print(name) logger()



直接调用name,logger()方法
View Code

 随机验证码,

#!/usr/bin/env python

import random

checkcode=''

for i in range(5):

    current=random.randrange(0,5)
    if current==i:
        tmp=chr(random.randint(65,90))
    else:
        tmp=random.randint(0,9)
    checkcode+=str(tmp)

print(checkcode)
View Code

 

posted @ 2017-04-18 15:29  寻_找北极星  阅读(78)  评论(0)    收藏  举报