📜  python从字符串中提取字符之前的所有字符 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:03.907000             🧑  作者: Mango

代码示例1
s1 = "Username: How are you today?"
>>> s1.split(':')
['Username', ' How are you today?']
>>> s1.split(':')[0]
'Username'