Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- re_string = "(\d+\.\d+|\d+|)(\D*)\s(ohms)"
- inputs = [
- "10 ohms",
- "100 ohms",
- "220 ohms",
- "330 ohms",
- "470 ohms",
- "680 ohms",
- "1k ohms",
- "10k ohms",
- "22k ohms",
- "47k ohms",
- "4.7k ohms",
- "100k ohms",
- "330k ohms",
- "2M ohms"
- ]
- for input in inputs:
- i = re.search(re_string, input)
- print(i.group(1))
- print(i.group(2))
- print(i.group(3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement