Cofused with regex in Python -


this question has answer here:

i have following code:

re.findall(r'(\w)*','2sq')

why result of programme is: ['q', '']?

i thought ['2','s','q',' '].

remove * , you'll expected result. * greedy, looks want each \w , findall that.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -