Hello world开始
生活随笔
收集整理的這篇文章主要介紹了
Hello world开始
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一切都從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')?
轉載于:https://www.cnblogs.com/PythonInMyLife/p/6918887.html
總結
以上是生活随笔為你收集整理的Hello world开始的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Altium差分布线和等长方法
- 下一篇: 2016和2017的区别就是昨晚和今早