python长整型取消了_如何在Python中将长整型表达式规则拆分为多行

这实际上可行吗?我有一些非常长的正则表达式规则,很难理解,因为它们不能一次融入屏幕。例:

test = re.compile('(?P.+):\d+:\s+warning:\s+Member\s+(?P.+)\s+\((?P%s)\) of (class|group|namespace)\s+(?P.+)\s+is not documented' % (self.__MEMBER_TYPES), re.IGNORECASE)

反斜杠或三重引号将无法正常工作。

编辑。我结束了使用VERBOSE更多。以下是正则表达式模式现在的样子:

test = re.compile('''

(?P # Capture a group called full_path

.+ # It consists of one more characters of any type

) # Group ends

: # A literal colon

\d+ # One or more numbers (line number)

: # A literal colon

\s+warning:\s+parameters\sof\smember\s+ # An almost static string

(?P # Capture a group called member_name

[ #

^: # Match anything but a colon (so finding a colon ends group)

]+ # Match one or more characters

) # Group ends

( # Start an unnamed group

:: # Two literal colons

(?P # Start another group called function_name

\w+ # It consists on one or more alphanumeric characters

) # End group

)* # This group is entirely optional and does not apply to C

\s+are\snot\s\(all\)\sdocumented''', # And line ends with an almost static string

re.IGNORECASE|re.VERBOSE) # Let's not worry about case, because it seems to differ between Doxygen versions

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值