Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of re.findall function in python

Shulou Source: shulou.com Published: 2022-06-03 17:34:20 10月02日 Update

Editor to share with you what is the use of the re.findall function in python. I hope you will get something after reading this article. Let's discuss it together.

1. The findall function returns a list of regular expressions for all matching results in a string.

2. If the regular match that is not grouped is the returned regular match, the packet returns the grouped match instead of the whole regular match.

Example

Find all the substrings that match pattern (do not overlap) and put them in the list.

Import relst = re.findall ("[1-9]\ d *", "qw21313h2o58p4kjh8123jkh8435u") for x in lst: print (xPowerend = "") # output result: 21313 1 58 4 8123 8435 after reading this article, I believe you have a certain understanding of "what is the use of re.findall function in python". If you want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

Tags: Regular function grouping article result character string done instance more knowledge industry expression information information channel channel and will output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL vpn MariaDB OPPO Reno