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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -