(cls, code)
return re.sub(cls.re_pytokens, subf, code)
Removes comments (#...) from python code.
Removes comments (#...) from python code.
Removes comments ( # ... ) from python code .
def split_comment(cls, code):
        """ Removes comments (#...) from python code. """
        if '#' not in code: return code
        #: Remove comments only (leave quoted strings as they are)
        subf = lambda m: '' if m.group(0)[0]=='#' else m.group(0)
        return re.sub(cls.re_pytokens, subf, code)
def split_comment ( cls , code ) : if '#' not in code : return code #: Remove comments only (leave quoted strings as they are) subf = lambda m : '' if m . group ( 0 ) [ 0 ] == '#' else m . group ( 0 ) return re . sub ( cls . re_pytokens , subf , code )