python學習筆記10(使用者互動程式)

來源:互聯網
上載者:User

標籤:python 學習筆記

注釋

單行:#

多行:上下各用3個連續單引號或雙引號

3個引號除了多行注釋,還可以列印多行

舉例:

msg = name = (name)(msg)

運行結果第二個print就是列印3行字串。

如果單行,用引號即可:msg = "Alex Li"


python中,單引號和雙引號相同,除了單套雙或雙套單。

例:msg = "I‘m Alex Li"


使用者輸入

舉例:

 = ()password = ()(,password)


格式化輸出

%s(string),%d,%f的區別

列印變數的資料類型:print(type(變數名))


raw_intpu   python 2.x

input python 3.x

python2中,推薦使用raw_input,如果使用input,需要在輸入字串變數值的時候,內建""引號。


課堂練習:

本文出自 “踩出腳印” 部落格,請務必保留此出處http://zoucuo.blog.51cto.com/962798/1885563

python學習筆記10(使用者互動程式)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.