-1

I have one phone number "+9779841915591" and for this number I want to arrange into international caller id space state id space and phone using regex.

subas khanal
  • 9
  • 1
  • 7
  • I want in this format: +977 9841 915591 – subas khanal May 14 '19 at 13:07
  • 1
    Possible duplicate of [What's the best way to format a phone number in Python?](https://stackoverflow.com/questions/7058120/whats-the-best-way-to-format-a-phone-number-in-python) – djoffe May 14 '19 at 13:34
  • Thanks for your link. I got that answer but now I have list :list =["1234567890", "+9779841915591", "2375952486"], Here I want to clean phone number by replacing first three number by country code how can I clean this? – subas khanal May 14 '19 at 13:41

1 Answers1

0

I'm gonna just leave this here

 phoneNumRegex = re.compile(r'+\d\d\d \d\d\d\d \d\d\d\d\d\d')

More info: https://automatetheboringstuff.com/chapter7/

Soumitra Shewale
  • 165
  • 1
  • 1
  • 13