tin current last cti col div function key
一切都从 Hello world 开始,代码如下:
- 1 #!/usr/bin/env python 定义程序执行过程中调用的环境 在linux下 直接调用python来解析执行该文件
- 2 #-*- coding:utf-8 -*- 也可以是 #coding=utf-8 ,作用是设置代码在执行过程中的编码形式,保证可以输出中文,避免中文乱码输出。
- 3
- 4 #输出一个hello world
- 5 print("hello world")
print 函数时内置函数。在 Python 终端下可以使用 help(print) 来查看对应的帮助文档信息。
- >>> 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.
利用 print 输出 1,2,3,4 以 \ t 结尾
- print(1,2,3,4,sep=',',end='\t')
Hello world 开始
来源: http://www.bubuko.com/infodetail-2093957.html