import retext = "[H] $10 [W] 100 credits"print( dict(re.findall(r'\[([HW])][^][\d]*(\d+(?:\.\d+)?)', text)) )
Standard input is empty
{'H': '10', 'W': '100'}
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!