python print
2015-06-01 15:42
609 查看
>>> help(print) Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.
# 输出结果是有引号的 >>> 'Python' 'Python' # 输出结果没有引号 >>> print('Python') Python >>> 5 + 8 13 >>> 8/4 2.0 >>> 8//4 # 如果想要输出整数,需要用两个除号“//” 2 >>> 8*8 64 >>> print(8//2) 4字符串拼接
>>> 'I'+' '+'LOVE'+' '+'PYTHON'+' '+'!' 'I LOVE PYTHON !' >>> 'I LOVE PYTHON !' 'I LOVE PYTHON !' >>> 'I LOVE PYTHON ! ' * 3 'I LOVE PYTHON ! I LOVE PYTHON ! I LOVE PYTHON ! '
>>> print('line1','line2',sep="\n") line1 line2 >>> print('line1','line2',sep='\n\n') line1 line2 >>> print('line1',end="\n");print('line2') line1 line2 >>> print('line1',end="-------不让换行------");print('line2') line1-------不让换行------line2
<> I love "python" !
print("I love \"python\"!")
print('I love "python"!')
在IDLE中输入"print('python')",按F5执行,可得到以下结果。
>>> ================================ RESTART ================================
>>>
python
相关文章推荐
- python简单程序使用signal模块处理僵死进程
- Numpy学习笔记3-数组的运算
- source upgrade python version
- 编译安装python2.7及相关模块(debian5.0.1)
- Python 反编译工具uncompyle2
- python-sqlite3
- python input 和raw_input 区别
- 深入理解python之self
- python模块相关
- python--FTP两个文件夹间的同步
- python编程中字典插入数组的误区
- python 基础 学习 内置函数
- Python用subprocess的Popen来调用系统命令
- Python快速入门(2)
- python使用Image处理图片常用技巧分析
- python实现图片变亮或者变暗的方法
- Python编码规范
- wxPython中listbox用法实例详解
- Python 多进程并发操作中进程池Pool
- PEP8 Python 编码规范整理