一句正则表达式删除所有C语言注释

2015-11-01 0 616
一句正则表达式删除所有C语言注释
import re
code_file = open('test.c','r')
code_content = code_file.read()
code_content_temp = re.sub(r'((?<=\n)|^)[ \t]*\/\*.*?\*\/\n?|\/\*.*?\*\/|((?<=\n)|^)[ \t]*\/\/[^\n]*\n|\/\/[^\n]*','',code_content)
print(code_content_temp)

遇见资源网 python 一句正则表达式删除所有C语言注释 http://www.ox520.com/15870.html

上一篇: 阶乘
下一篇: 二进制复制文件
常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务