strings.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:outis 作者: SySS-Research 项目源码 文件源码
def strip_powershell_comments(data):
    """
    Strip block comments, line comments and empty lines from a PowerShell source file.
    """

    # strip block comments
    strippedCode = re.sub(re.compile('<#.*?#>', re.DOTALL), '', data)

    # strip blank lines and lines starting with #
    # noinspection PyPep8
    strippedCode = "\n".join([line for line in strippedCode.split('\n') if ((line.strip() != '') and
        (not line.strip().startswith("#")))])

    # TODO: strip comments at the end of lines

    return strippedCode
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号