I have a python file, which looks something like this:
class Hello():
something = 0
someotherthing = 2
class Heythere():
whatsthis()
def whatsthis():
dosomething=0
class Anotherclass():
imavar=2
whatsup='?'
....
And it continues like this for some time, there are a lot of classes. I want to capture each class into a list using a regular expression. I always want the regex to start capturing the strings at "class" and always want it to stop where there are two line breaks in a row. Here is what I tried, and got nowhere. I am not familiar with regular expression syntax at all so maybe I am doing things completely wrong:
import re
r = open('python.py','r').read()
x = re.findall(r'(class?)\n\n', r)
x always returns an empty list []
Not sure where I am doing this wrong, but I am fairly certain my syntax is completely off. I just... don't know where to start