Advertisement
chertila

Untitled

Mar 5th, 2023 (edited)
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. import re
  2.  
  3.  
  4. def main(input_str):
  5.     result = {}
  6.  
  7.     matches = re.findall(r"glob\s(-?\d+)\s*=>\s*q\((\w+)", input_str)
  8.     for x in matches:
  9.         key = x[1]
  10.         value = x[0]
  11.         result[key] = int(value)
  12.     return result
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement