摘要: win移植linux python执行shell脚本 os.system("command") os.popen("command") os.popen() 返回的是一个文件对象 subprocess.call() print(subprocess.call(["ls","-l"],shell=Fa 阅读全文
posted @ 2020-07-29 18:06 friedCoder 阅读(163) 评论(0) 推荐(0) 编辑
摘要: iterable 与 iterator range returns an iterable, not an iterator. To get an iterator, you need to call iter() >>> x = range(20) >>> next(x) TypeError: ' 阅读全文
posted @ 2020-07-29 17:18 friedCoder 阅读(110) 评论(0) 推荐(0) 编辑
摘要: anaconda winerror 127找不到指定的程序 现象**:conda install package 时,报错 winerror 127找不到指定的程序。 环境:win 10 + anaconda 4.8.0 / python 3.7。 解决(亲测):参考帖子https://github 阅读全文
posted @ 2020-07-29 10:07 friedCoder 阅读(247) 评论(0) 推荐(0) 编辑
摘要: type isinstance() 与 type() 区别: type() 不会认为子类是一种父类类型,不考虑继承关系。 isinstance() 会认为子类是一种父类类型,考虑继承关系。 如果要判断两个类型是否相同推荐使用 isinstance()。 class A: pass class B(A 阅读全文
posted @ 2020-07-23 09:35 friedCoder 阅读(197) 评论(0) 推荐(0) 编辑
摘要: npm 指令 查看npm安装路径 npm config ls 全局安装包 npm install package -g 查看全局安装的模块 npm list --depth=0 -g Cannot find Module xxx 1.书写错误,往往是写错了模块的名称,而导致无法加载 2.未安装相关模 阅读全文
posted @ 2020-07-16 07:53 friedCoder 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Byte和char char 是字符型,byte 是字节型 char是用来表 示一个字符,而不是一个字,因为一个字要占用两个字节。而存储一个ANSI字符只需一个字节。 byte类型是最自由的一种。它就占用一个字节,但没有定义这个字节拿来干什么。Byte定义为一个Unsigned char类型。 也就 阅读全文
posted @ 2020-07-10 20:58 friedCoder 阅读(682) 评论(0) 推荐(0) 编辑
摘要: 经验分享 - 如何高效阅读一个项目 对于一个程序员来说,阅读优秀的项目代码是一个学习的好方法,但对于项目越大,阅读的难度也越大。 先说一个最“笨”的方法,初学者在接触到项目代码后往往从入口函数开始,一行一行地往下看,这种方法不适合规模较大的项目,阅读的效率非常低。 下面介绍另外几种的方法。 既然是阅 阅读全文
posted @ 2020-06-13 20:59 friedCoder 阅读(632) 评论(0) 推荐(0) 编辑
摘要: C++中慎用malloc malloc是C语言中常用的内存申请方式,C++也支持,但是对于STL来说却不兼容,取而代之的是new。 情景:曾写过一个C与C++混合的项目,内存申请使用了malloc,同时使用了std::vector,程序中两种结构之间进行了数据流通。但是程序运行时,部分指针的值被“莫 阅读全文
posted @ 2020-06-12 12:19 friedCoder 阅读(1551) 评论(1) 推荐(2) 编辑
摘要: 对于这类宏(#fidef)最好顶格 其次#endif会忽略后面一切内容,只能跟注释 { #ifndef DEBUG ... #endif } //error,因为#endif后面的}被忽视掉 阅读全文
posted @ 2020-05-28 11:20 friedCoder 阅读(265) 评论(0) 推荐(0) 编辑
摘要: std::string length() and size() member functions. As per the documentation, these are just synonyms. Error: invalid operands of types ‘const char [35] 阅读全文
posted @ 2020-05-23 14:46 friedCoder 阅读(177) 评论(0) 推荐(0) 编辑