在一次采访中我被问到,如果在一个文件A中定义了一些静态函数,在文件B中你想要使用这个静态函数 - 你将如何使用它?
我的答案是:
newfun在文件A中声明一个新函数,它将调用静态函数并newfun在文件B中调用它.但他对这些答案并不满意.
能否请你提供一些更好的违规解决方案static.
我在 Win10 上遇到 _ssl 问题。我已将 python 包和代码从 Windows 7 移至 Windows 10。一开始我面临以下问题:
导入错误:缺少必需的依赖项 ['numpy']
但是这个问题通过重新安装 numpy 和 pandas 的 .whl 包得到了解决。
目前我在执行代码时面临以下问题:
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified procedure could not be found.
Run Code Online (Sandbox Code Playgroud)
参考关于堆栈溢出的其他问题并尝试了几个步骤:
按照此Python 3.7 anaconda 环境中的建议更改路径变量- 导入 _ssl DLL 加载失败错误
安装 pyopenssl 。
更新了系统环境变量。
重新启动了pycharm。
目前在 Anaconda 提示符下显示为:
(base) C:\>
(base) C:\>python
Python 3.7.0 (default, Aug 14 2018, 19:12:50) [MSC v.1900 32 bit …Run Code Online (Sandbox Code Playgroud) 我试图编写自己的atoi()函数实现,并尝试了两个不同的代码:
#include <stdio.h>
#include <string.h>
int myatoi(const char *string);
int main(int argc, char* argv[])
{
printf("\n%d\n", myatoi("str"));
getch();
return(0);
}
int myatoi(const char *string){
int i;
i=0;
while(*string)
{
i=(i<<3) + (i<<1) + (*string - '0');
string++;
// Don't increment i!
}
return i;
}
Run Code Online (Sandbox Code Playgroud)
和
#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int x;
gets(str);
printf("%d",myatoi(str));
}
int myatoi(char *str) {
int res =0;
int i;
for (i = 0; str[i]!= '\0';i++) {
res = …Run Code Online (Sandbox Code Playgroud)