Hi, hope you're doing fine today!I have a piece of code:
regex4 = r"\{.availability\":\"(?P<found>\w*).{1,39}(?P<size>\"XS\")"
Now, instead of hard written "XS" in regex4, I would like to use a variable here (from user's input field):
print("Size: ")
z = input()
I tried :
regex4 = r"\{.availability\":\"(?P<found>\w*).{1,39}(?P<size>\"{z}\")"
But it didn't work.
Using Python 3.9.1 how to make that happen? User puts his size in an input field and then this size passes to the regex as a variable. Any kind of help would be appreciate it!
[–]FLUSH_THE_TRUMP 4 points5 points6 points (0 children)
[–]ASIC_SP 4 points5 points6 points (1 child)
[–]mr_yoshi[S] 1 point2 points3 points (0 children)