pro*_*eek 2 python regex comments
使用Java,我可以拆分字符串并给出一些详细的解释
String x = "a" + // First
"b" + // Second
"c"; // Third
// x = "abc"
Run Code Online (Sandbox Code Playgroud)
如何在python中进行等效?
我可以拆分字符串,但是我不能像使用Java一样对此进行评论.
x = "a" \
"b" \
"c"
Run Code Online (Sandbox Code Playgroud)
我需要此功能来解释正则表达式的用法.
Pattern p = Pattern.compile("rename_method\\(" + // ignore 'rename_method('
"\"([^\"]*)\"," + // find '"....",'
Run Code Online (Sandbox Code Playgroud)
这个
x = ( "a" #foo
"b" #bar
)
Run Code Online (Sandbox Code Playgroud)
将工作.
这里的魔术由括号完成 - python自动继续任何未终止的brakets(([{)内部的行.请注意,python也会在字符串彼此相邻时自动连接(我们甚至不需要+操作符!) - 非常酷.
| 归档时间: |
|
| 查看次数: |
86 次 |
| 最近记录: |