fork(1) download
  1. import re
  2. regex = r"<td>(\w+)<\/td>"
  3. test_str = "<tr align=\"right\"><td>1</td><td>Michael</td><td>Jessica</td>"
  4. values=[]
  5. matches = re.finditer(regex, test_str)
  6. for match in matches:
  7. if match.group(1).isnumeric():
  8. rank = int(match.group(1))
  9. else:
  10. values.append(match.group(1))
  11.  
  12. print(rank)
  13. print(values)
Success #stdin #stdout 0.01s 28384KB
stdin
Standard input is empty
stdout
1
['Michael', 'Jessica']