摘要: Python中的垃圾回收是以引用计数为主,分代收集为辅。引用计数的缺陷是循环引用的问题。 在Python中,如果一个对象的引用数为0,Python虚拟机就会回收这个对象的内存。 转自Kevin Lu博客,详见:https://www.cnblogs.com/Xjng/p/5128269.html 阅读全文
posted @ 2019-05-24 17:18 飞虎就是我 阅读(192) 评论(0) 推荐(0)
摘要: finally不管是否发生异常,都会执行。 如果出现异常,又没有编写except,则执行完finally之后,后面代码不会执行 阅读全文
posted @ 2019-05-24 13:37 飞虎就是我 阅读(320) 评论(0) 推荐(0)
摘要: 1 s=input('Please input the string:') 2 temp=list(s) 3 temp.reverse() 4 #列表转换为字符串 5 print(''.join(temp)) 阅读全文
posted @ 2019-05-24 11:48 飞虎就是我 阅读(1962) 评论(0) 推荐(0)
摘要: 这里直接使用sort函数,没有用排序算法排序 sort是升序排序,默认sort(reverse=False) 阅读全文
posted @ 2019-05-24 10:56 飞虎就是我 阅读(340) 评论(0) 推荐(0)