我们,
我在SQL中使用此代码:
DECLARE @STRING VARCHAR(MAX)
SET @STRING = 'Making this course amazing - 3h'
SELECT REVERSE(SUBSTRING(REVERSE(@STRING),1,charindex('-',reverse(@STRING))-1))
我正在努力使其适应Python,但是你成功了。我尝试的代码是:
import re
Task = 'Making this course amazing - 3h'
print(re.findall("-" ,Task, flags=re.I))
但它只给我' - '而且我希望每个人都来自' - '