How can I compare a char to '\n' in python? Here is what I'm trying to do:

```
def grabInstructionsExecuted (str, beg):
    index = beg
    while str[index] != '\n'
        index += 1;
    return str[beg:index-1]

```

However, I get this error:

```
File "grabMIPS.py", line 7
    while str[index] != '\n'
                           ^
SyntaxError: invalid syntax

```

I'm new to python, this seems pretty basic but I can't get it to work. Thank you.