1syntax
2re.sub(pattern, repl, string, max=0)
3#!/usr/bin/python
4import re
5
6phone = "2004-959-559 # This is Phone Number"
7
8# Delete Python-style comments
9num = re.sub(r'#.*$', "", phone)
10print "Phone Num : ", num
11#output Phone Num : 2004-959-559
12
13# Remove anything other than digits
14num = re.sub(r'\D', "", phone)
15print "Phone Num : ", num
16#output Phone Num : 2004959559