Parsing is tricky and difficult.
In general, I would not recommend trying to parse without a state machine. For example, what if the '#' is part of a multiline ("""...""" in python) ?
There are libraries that exist which may simplify parsing (well, they are supposed to, but understanding them might prove challenging if you have no prior inkling), for example, in C++, one can only recommend Spirit.
There are already been some pointers suggested to help you using string methods, though they only related to detecting if the first meaningful character is a '#'.
If you do not 'fear' multiline (that is if what you are trying to parse does not have such a feature), you will still have to manage 'simple' lines, which can be done by counting, taking escapes into account:
print "My \"#\" is: ", phoneNumber # This is my phone number
If you parse this line badly, you'll end up with an error... (for example)
If you cannot use a library, a state machine is the way to go, writing a parser is quite fun in general, it gives you insights as to why the notation has been developed in a certain way.