fork download
  1. import re
  2.  
  3. s = '1٤٥٦4'
  4.  
  5. # pega todos os dígitos (inclusive ٤٥٦)
  6. print(re.findall(r'\d', s))
  7.  
  8. # só pega os de 0 a 9
  9. print(re.findall(r'[0-9]', s))
  10. print(re.findall(r'\d', s, flags = re.ASCII))
  11.  
Success #stdin #stdout 0.02s 27752KB
stdin
Standard input is empty
stdout
['1', '٤', '٥', '٦', '4']
['1', '4']
['1', '4']