split()方法有以下參數:
示例用法:
str = "Hello World"
result = str.split() # 使用默認的空格分隔符進行分割
print(result) # 輸出:['Hello', 'World']
str = "apple,orange,banana"
result = str.split(",") # 使用逗號作為分隔符進行分割
print(result) # 輸出:['apple', 'orange', 'banana']
str = "apple,orange,banana"
result = str.split(",", 1) # 使用逗號作為分隔符進行分割,最多分割1次
print(result) # 輸出:['apple', 'orange,banana']