簡明python教程

來源:互聯網
上載者:User

標籤:查詢   code   second   字串   python版本   blog   hello   string   轉義符   

linux查詢python版本:python -V

linux進入python:python

退出python:CTRL+D

 

使用源檔案:helloworld.py

運行這個程式:python helloworld.py

 

目錄添加到PATH變數中:PATH=$PATH:/home/swaroop/mydir完成。其中“/home/swaroop/mydir ”是我想要添加到PATH變數中的目錄。

 

python中字串使用:

(1)使用單引號(‘)

‘Quote me on this’

(2)使用雙引號(“)

雙引號中的字串與單引號中的字串的使用是完全相同的。

" What‘s your name?"

(3)使用三引號(”’或者“‘”’)

利用三引號,可以指示一個多行的字串。你可以在三引號中自由的使用單引號和雙引號。

‘‘‘ This is a multi-line string.This is the first line.This is the second line."waht‘s your name?,"I asked.He said "Bond,James Bond. " ‘‘‘

(4)轉義符

在字串中輸出’ " \,使用\‘ \" \\

注意:“This is the first sentence.\

This is the second sentence.”=====>等價於“This is the first sentence.This is the second sentence.”

簡明python教程

聯繫我們

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