mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
6 lines
192 B
Python
6 lines
192 B
Python
import re
|
|
phone = "2004-959-559 # this is a phone number"
|
|
num = re.sub('#.*$', "", phone)
|
|
print("the phone number is: ", num)
|
|
num = re.sub('\\D', "", phone)
|
|
print("the phone number is: ", num) |