一品网
  • 首页

函数学习


def add(a,b):
    print(a+b)
add(3,2)
结果:5

def add(a,b=6):
    print(a+b)
add(a=3)
结果:9

return 返回值 
def login(username="wuya",password='admin'):
    if username=='wuya' and password=='admin':
        return True
    else:
        return False
def profile():
    if login():
        return '登录成功'
    else:
        return '账号或者密码有错误'
print(profile())
结果:登录成功
python学习

相关


python学习(十)函数 内容

selenium python学习笔记之八 窗口截图、验证码处理

python学习随笔day15

【python学习笔记】openpyxl操作excel高阶操作

Python学习之PIL库的使用

Python学习笔记-----类和对象知识点2)---类的继承

Python学习笔记-----类和对象知识点2)---类的继承

【Python学习笔记六】获取百度搜索结果以及百度返回“百度安全验证”问题解决

【Python学习笔记七】从配置文件中读取参数

【Python学习】 把list, tuple中的元素用write()方法写入文件

python学习day37笔记

python学习day35笔记

标签

一品网 冀ICP备14022925号-6