Python 字串(String)教學
📘 基本介紹
name = 'Alice'
greeting = "Hello, world!"🧩 建立字串
# 單引號或雙引號
text1 = 'Hello'
text2 = "World"
# 三引號可建立多行字串
description = '''This is a
multi-line
string.'''🔍 索引與切片(Indexing & Slicing)
🔤 常用方法
方法
說明
範例
🧮 格式化字串(String Formatting)
🧠 判斷與檢查
🪄 字串反轉
🧰 多行處理與跳脫字元
💡 小結
Last updated