作者在 2016-03-24 09:10:58 发布以下内容
传参有返回传参无返__author__ = 'pop' def add(c,d): s = c + d return s def sub(g,h): s = g - h return s def mul(m,n): s = m * n return s def mov(o,p): s = o / p return s a = input("please enter number") b = input("please enter next number") j = raw_input("please enter add ,sub ,mul,div") if j == "+": print(add(a,b)) elif j == "-": print(sub(a,b )) elif j == "*": print(mul(a,b)) elif j == "/": print(mov(a,b )) exit
无参无返
___author__ = 'pop' def add(): w = a + b print w def sub(): k = g - h print k def mul(): l = m * n print l def div(): v = o / p print v a = input("please enter number") b = input("please enter next number") j = raw_input("please enter add ,sub ,mul,div") if j == "+": w = add() elif j == "-": k == sub() elif j == "*": l == mul() elif j == "/": v == div() exit
无参有返
__author__ = 'pop' def add(): s = a + b return s def sub(): s = a - b return s def mul(): s = a * b return s def mov(): s = a / b return s a = input("please enter number") b = input("please enter next number") j = raw_input("please enter add ,sub ,mul,div") if j == "+": s = add() print s elif j == "-": s = sub() print s elif j == "*": s = mul() print s elif j == "/": s = div() print s exit
#-*- coding:UTF-8 -*- # 解码方式 __author__ = 'pop' from selenium import webdriver # import time def testLogin(testname,testpassword,revtype,realvalue): bruce = webdriver.Firefox() #start firfox brower .bruce定义为火狐浏览器 bruce.maximize_window() # max windows bruce.get("http://192.168.242.128:8088/Tinyshop/") # url time.sleep(3) bruce.find_element_by_link_text("注册").click() bruce.find_element_by_id("email").send_keys(testname) bruce.find_element_by_name("password").send_keys(testpassword) bruce.find_element_by_name("repassword").send_keys(testpassword) bruce.find_element_by_name("verifyCode").send_keys("1111") bruce.find_element_by_id("readme").click() bruce.find_element_by_class_name("btn").click() #actvalue = bruce.find_element_by_xpath(".//*[@id='content']/div/div/div[1]").text actvalue = bruce.find_element_by_xpath(revtype).text print actvalue #bruce.implicitly_wait(3) if realvalue == actvalue: print "ok" else: print "suck my dick" time.sleep(3) bruce.close() #testLogin("5546464@qq.com","a123456","恭喜您,注册成功!") testLogin("554646829@qq.com","123456",".//*[@id='content']/div/div/div[1]",u"恭喜您,注册成功!") time.sleep(2) testLogin("5546@qq.com","123",".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/label",u"6-20任意字符组合") time.sleep(2) testLogin("5546@qq.com","123",".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/label",u"6-20任意字符组合") time.sleep(2) testLogin("5546@qq.com","123",".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/label",u"6-20任意字符组合") time.sleep(2) testLogin("5546@qq.com","123",".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/label",u"6-20任意字符组合")