Python 點滴積累(2)

2021-10-06 23:28:22 字數 955 閱讀 5834

1.使用方法修改字串的大小寫

>>> name="ada lovelace"

>>> print(name.title())

ada lovelace

>>> print(name.upper())

ada lovelace

>>> print(name.lower())

ada lovelace

2.合併字串
>>> name="ada lovelace"

>>> print(name.title())

ada lovelace

>>> print(name.upper())

ada lovelace

>>> print(name.lower())

ada lovelace

3.使用製表或換行符來新增空白
>>> print("python")

python

>>> print("\tpython")

python

>>> print("python is \n a language.")

python is

a language.

4.刪除空白
>>> msg="  hello python  "

>>> print(msg)

hello python

>>> print(msg.lstrip())

hello python

>>> print(msg.rstrip())

hello python

>>> print(msg.strip())

hello python

>>> print(msg)

hello python

此處,要使刪除空白的源字串發生變化,必須將刪除空白的字串賦值給源字串。

Python 點滴積累(4)

for迴圈 colors red blue white green for color in colors print color red blue white green使用range for value in range 1,6 print value 123 45range 可以作為list ...

git點滴積累

1 一些入門的命令 進入你要傳到遠端庫的專案下 例 cd desktop order這裡是進入桌面的order資料夾中,接著輸入git init為了讓專案資料夾下有 git 檔案,可以輸入 ls a 命令檢視 git add 將當前目錄增加到倉庫中,那個 代表當前目錄,也可以換成其他檔名 git c...

點滴積累 使用IIS Express

iis express是乙個微軟推出的一款免費,且小型 輕量特別適合asp.net開發人員使用的web開發伺服器。在沒有iis express之前,開發人員只能使用下面兩種方案 既然已經有了這兩個選擇,為什麼還要推出iis express呢?這是由於這兩個方案的不足決定的,如下 但是iis expr...