embed_url='http://www.vimeo.com/52422837'response=re.search(r'^(http://)?(www\.)?(vimeo\.com/)?([\/\d+])',embed_url)returnresponse.group(4)响应是:5我很期待52422837有什么想法吗?我真的很不擅长正则表达式:S 最佳答案 不要重新发明轮子!>>>importurlparse>>>urlparse.urlparse('http://www.vimeo.com/52422837')ParseRe