###### tags: `Python` # CH5 字串 ## 創建字串 ```python= a='Python' b="Python" ``` >`""` `''`皆可用來創建字串 ## 轉型 * 皆可用 `str()` 轉換 int & float ## 串接 1. 連接用`+` ```python print('123'+'345') ``` >123345 2. 複製用`*` ```python print('123'*3) ``` >123123123 ## 提取 1. ==**當成陣列使用**== ```python= a="Python" print(a[0]) ``` >P ## 常用function ### len() 1. 獲得字串的長度 ### split() 1. 分割字串 ### replace() 1. 取代字串 2. `replace(想替代的,替代的,次數)`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up