Python资料之print()函数
2017-12-22 17:53
155 查看
函数定义:
print(self, *args, sep=’ ‘, end=’\n’, file=None)
以3.5版本为例
常规的用法:
特殊用法:
1、输出重复内容
内容*个数
例子:输出50个a
2、end参数使用
print函数的end参数是用来控制输出是以什么为结尾的,默认为\n换行符。
官方说明:
例子:print输出不换行
3、sep参数使用
print函数的sep参数是在有多个输出内容时,用来设定多个内容分隔符的。
官方说明:
例子:print输出用:分割两个内容
4、file参数使用:
官方说明:
print(self, *args, sep=’ ‘, end=’\n’, file=None)
以3.5版本为例
常规的用法:
print(内容)
特殊用法:
1、输出重复内容
内容*个数
例子:输出50个a
print("a"*50)
2、end参数使用
print函数的end参数是用来控制输出是以什么为结尾的,默认为\n换行符。
官方说明:
string appended after the last value, default a newline.
例子:print输出不换行
print(内容,end="")
3、sep参数使用
print函数的sep参数是在有多个输出内容时,用来设定多个内容分隔符的。
官方说明:
string inserted between values, default a space.
例子:print输出用:分割两个内容
print(内容1,内容2,sep=";")
4、file参数使用:
官方说明:
a file-like object (stream); defaults to the current sys.stdout.
相关文章推荐
- Python print函数用法,print 格式化输出
- Python print函数用法,print 格式化输出
- Python3.3 print函数用法,print 格式化输出
- python print 函数与print语句区别
- Python print函数用法,print 格式化输出(python格式化输出)
- Python3.x中的print()函数
- 关于Python中的 print 函数的缩进问题
- Python标准库:内置函数print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
- python中print()函数的“,”与java中System.out.print()函数中的“+”功能详解
- python print函数
- 【python学习资料】各种python 函数参数定义和解析 --转载自byte_way
- Python3.x --- Print函数用法
- Python2.7 Print函数
- Python3.3 print函数用法,print 格式化输出
- 一个月能入门Python吗?月薪25K的大佬给我整理了函数和模块资料
- Python 3 语法小记(一)入门 (print 函数用法总结)
- Python print函数重定向
- python 中 print 函数用法总结
- Python标准库:内置函数print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
- 为什么print在Python 3中变成了函数?