我有以下代码:
url = 'abcdc.com' print(url.strip('.com'))
我期望: abcdc
abcdc
我有: abcd
abcd
现在我做
url.rsplit('.com', 1)
有没有更好的办法?
python string
python ×1
string ×1