+ 2
How to generate a random string suitable for a random regular expression pattern for minimal time interval in Python?
For example pattern=r'[A-Z]{1,3}[0-9]{1,4}[a-z]+.[\w]+' So, how to create random string to this pattern for minimal time?
2 odpowiedzi
+ 1
Here's a start: i.e this part .....pattern=r'[A-Z]{1,3}.......
import random
import string
print(*random.choices(string.ascii_uppercase, k=random.randint(1, 3)), sep='')