栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python入门--函数参数的定义,以及print输出格式的设置

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python入门--函数参数的定义,以及print输出格式的设置

#函数的参数定义
#函数定义时,给形参设置默认值,只有与默认值不符的时候,才需要传递实参
######################33

def fun(a,b=10):#给形参设置默认值
    print(a,b)

fun(100)#只穿一个参数,b采用默认值  100 10
fun(20,30)#30将默认值替换,   20 30

print('hello')#默认换行
print('world')


'''print()#按住ctrl后点击print
def print(self, *args, sep=' ', end='n', file=None): # k
默认end='n'换行
'''
print('hello',end='t')
print('world')
print('hello',end='')
print('world')
print('hello',end=' ')
print('world')

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/753146.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号