url = "http://www.runoob.com/python/att-string-split.html" path = url.split('.')[-1] print(path)
输出: html
以.为分割符保留最后一段。