Remove only numbers from the python string

Asked 2 years ago, Updated 2 years ago, 18 views

I'll take a string To remove only numbers from the string and output them How do I write the code?

python

2022-09-22 20:30

1 Answers

import re

String = "123answkduf456"
p = re.compile("[^0-9]")
print ("".join(p.foundall))


2022-09-22 20:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.