python入門綜合,python入門

來源:互聯網
上載者:User

python入門綜合,python入門

#!/usr/bin/env python
#-*-coding:utf-8-*-
#以上是配置編寫環境的開始  
#第一行env表示運行當前環境變數內的python版本(2.x or 3.x)
#第二行表示編碼格式是utf-8支援中文注釋或者字串中文輸出(3.x以上預設支援)

print'hello world'    #第一個簡易代碼列印hello world
print('hello world') #在python3.x以上列印語句要加()表示 和java等一些語言類似
print'hello\nworld'    #在列印中加入\n代表換行,和你在文本txt輸入時Enter斷行符號一下類似。
print('hello\tworld') #在列印中\t表示分割字串,類似中間加tab或空格間距。
print'\"'    #列印特殊字元反引號"時要加入反斜線\來告訴編譯器識別
print"\\"    #同上同理
print"""
What's your name
My name is Cookie
Tanks Watching
"""
#列印方式的一種技巧,三個雙引號(單引號)可以按照使用者輸入的方式列印,類似txt文本。
#新人推薦PyCharm+windows系統+安裝python-x86-install,32位的安裝包(64位系統支援)很多python的第三方應用32位好找
#python官網:https://www.python.org/  官方第三方庫:https://pypi.python.org/pypi
#以下是列印結果:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.