如何在Python中使用外部变量,比如extern int x;
在C中?
例如,
main1.py:
from myfunc import print_a
a = 10
print a
print_a()
Run Code Online (Sandbox Code Playgroud)
myfunc.py:
def print_a():
global a
print a
Run Code Online (Sandbox Code Playgroud) 我刚安装ycm,一切看起来都不错,但我发现小问题.问题如下:
import os # os is built-in library
os. # ycm helps to complete members of the class.
import numpy # numpy is not built-in library, where its location is site-packages.
numpy. # nothing happened. ycm shows 'pattern not found' message.
Run Code Online (Sandbox Code Playgroud)
我想,这将是一个简单的问题.但我还没找到解决方案.我认为,有一些配置文件,我可以在其中为我的项目定义"搜索路径".
如果我能找到解决方法,我将不胜感激.
最好,
Je-Hoon Song