摘要: pip:在线安装python包的工具 http://www.ttlsa.com/python/how-to-install-and-use-pip-ttlsa/ 阅读全文
posted @ 2018-08-16 15:54 Cony365 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ramdom随机模块 用法: random.random() 返回[0,1)的随机数 random.uniform(a, b) 返回[a, b]的随机数,a和b可以无序 random.randint(a, b) 返回[a, b]的整数,a和b必须有序a<=b random.randrange([st 阅读全文
posted @ 2018-08-13 10:54 Cony365 阅读(116) 评论(0) 推荐(0) 编辑
摘要: capitalize() 首字母变成大写 用法:w.capitalize() str.startswith(str1, begin=0, end=len(str)) 检查字符串是否以某个字符串开头 str.endswith(str1[, start[, end]) 检查字符串是否以某个字符串结尾 i 阅读全文
posted @ 2018-08-13 09:37 Cony365 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 上一篇笔记提到C++的智能指针,本节重点写一下智能指针的应用场景和使用中的坑 智能指针的背景 C++中比较头疼的是内存泄露问题,如果使用new动态申请内存,需要时刻记得delete回收内存,避免发生内存泄露。 对于分支很多的代码来讲,在多个分支进行内存释放很容易产生遗漏,排查代码非常浪费时间。 为了 阅读全文
posted @ 2018-08-07 14:46 Cony365 阅读(259) 评论(0) 推荐(0) 编辑
摘要: python中as的用法 对于文件操作,正常的操作方法是: filename = raw_input("please enter you filename:") # open and exceptiontry: fs = open(filename)except: print "open file 阅读全文
posted @ 2018-08-07 11:52 Cony365 阅读(168) 评论(0) 推荐(0) 编辑