【发布时间】:2012-10-12 13:37:38
【问题描述】:
用Java,我可以拆分字符串并给出一些详细的解释
String x = "a" + // First
"b" + // Second
"c"; // Third
// x = "abc"
如何在python中进行等价?
我可以拆分字符串,但不能像使用 Java 那样对此发表评论。
x = "a" \
"b" \
"c"
我需要这个功能来解释正则表达式的用法。
Pattern p = Pattern.compile("rename_method\\(" + // ignore 'rename_method('
"\"([^\"]*)\"," + // find '"....",'
【问题讨论】:
-
要评论正则表达式,请考虑
re.VERBOSE标志:docs.python.org/library/re.html#re.VERBOSE