我有一个文件,意味着一个实用程序文件.该文件应包含许多静态方法.
我应该这样定义类中的方法:
#utility.py
class utility(object):
@staticmethod
def method1(a,b,c):
pass
@staticmethod
def method2(a,b,c):
pass
Run Code Online (Sandbox Code Playgroud)
或者像这样使用它(没有课程):
#utility.py
def method1(a,b,c):
pass
def method2(a,b,c):
pass
Run Code Online (Sandbox Code Playgroud) 我已按照https://github.com/Valloric/YouCompleteMe中的说明进行操作, 并已安装:
cmake的 sudo apt-get install build-essential cmake
和Python标题 sudo apt-get install python-dev python3-dev
然后我cd ~/.vim/bundle/YouCompleteMe跑了:
./install.py --clang-completer我得到了:
Searching Python 2.7 libraries...
ERROR: unable to find an appropriate Python library.
然后我试过
python3 install.py --clang-completer
但仍然得到:
Searching Python 3.4 libraries...
ERROR: unable to find an appropriate Python library.
有没有人知道发生了什么?谢谢
我想用生菜写一些简单的单元测试.
(更具体地说,我正在遵循本教程:https://semaphoreci.com/community/tutorials/bdd-testing-a-restful-web-application-in-python)
我刚安装了生菜:
$ pip3 install lettuce
Run Code Online (Sandbox Code Playgroud)
当我跑
$ lettuce test/features
Run Code Online (Sandbox Code Playgroud)
我明白了:
Traceback (most recent call last):
File "/usr/local/bin/lettuce", line 9, in <module>
load_entry_point('lettuce==0.2.23', 'console_scripts', 'lettuce')()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.4/site-packages/lettuce/__init__.py", line 179
print "Error loading step definitions:\n", e
^
SyntaxError: Missing parentheses …Run Code Online (Sandbox Code Playgroud)