"strip characters from string python regex" Code Answer's
You're definitely familiar with the best coding language Python that developers use to develop their projects and they get all their queries like "strip characters from string python regex" answered properly. Developers are finding an appropriate answer about strip characters from string python regex related to the Python coding language. By visiting this online portal developers get answers concerning Python codes question like strip characters from string python regex. Enter your desired code related query in the search bar and get every piece of information about Python code related question on strip characters from string python regex.
strip characters from string python regex
syntax
re.sub(pattern, repl, string, max=0)
#!/usr/bin/python
import re
phone = "2004-959-559 # This is Phone Number"
# Delete Python-style comments
num = re.sub(r'#.*$', "", phone)
print "Phone Num : ", num
#output Phone Num : 2004-959-559
# Remove anything other than digits
num = re.sub(r'\D', "", phone)
print "Phone Num : ", num
#output Phone Num : 2004959559
Source: www.tutorialspoint.com
All those coders who are working on the Python based application and are stuck on strip characters from string python regex can get a collection of related answers to their query. Programmers need to enter their query on strip characters from string python regex related to Python code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about strip characters from string python regex for the programmers working on Python code while coding their module. Coders are also allowed to rectify already present answers of strip characters from string python regex while working on the Python language code. Developers can add up suggestions if they deem fit any other answer relating to "strip characters from string python regex". Visit this developer's friendly online web community, CodeProZone, and get your queries like strip characters from string python regex resolved professionally and stay updated to the latest Python updates.