Python regular matching

there is such a string
str ="< = hehe= > < = = > < = xixi= >"
that you want to get a list,list as follows:

result = ["hehe", "xixi", "haha"]

tell me how to use the re module to implement this, and how to write the rules.

Mar.09,2021

re.compile(r'<=(.*?)=>').findall(str)

re.compile(r'<=(\w+)=>').finditer(str)

this returns a generator.

Menu