小编Bis*_*ida的帖子

什么是"导入这个,那个,其他的东西"呢?

#!/usr/bin/env python
import this, that, other, stuff
class SomeObject(object):
    pass

def some_function(*args,**kwargs):
    pass

if __name__ == '__main__':
    print( "This only executes when %s is executed rather than imported" % __file__)
Run Code Online (Sandbox Code Playgroud)

上面的代码是做什么的?我得到的输出如下

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although …
Run Code Online (Sandbox Code Playgroud)

python

5
推荐指数
1
解决办法
293
查看次数

字符类中的字符顺序在正则表达式中是否重要

我在正则表达式中使用字符类来拆分字符串.我假设字符类中的字符顺序无关紧要.

以下是我用来分割字符串的两种模式"123.3+23+23.3".

[+/*-]

[+*-/]
Run Code Online (Sandbox Code Playgroud)

对于第一个模式,我得到的输出为:

123.3
23
23.3
Run Code Online (Sandbox Code Playgroud)

对于第二种模式,我得到的输出为:

123
3
23
23
3
Run Code Online (Sandbox Code Playgroud)

我不知道,为什么我得到不同的输出.请帮帮我.

java

0
推荐指数
1
解决办法
65
查看次数

标签 统计

java ×1

python ×1