6 python comments code-formatting
有没有我可以这样运行的程序:
py2py.py < orig.py > smaller.py
Run Code Online (Sandbox Code Playgroud)
其中orig.py包含带有注释和doc字符串的python源代码,而small.py包含相同的,可运行的源代码,但没有注释和doc字符串?
最初看起来像这样的代码:
#/usr/bin/python
"""Do something
blah blah...
"""
# Beware the frubnitz!
def foo(it):
"""Foo it!"""
print it # hmm?
Run Code Online (Sandbox Code Playgroud)
那么看起来像这样:
def foo(it):
print it
Run Code Online (Sandbox Code Playgroud)