摘要: 快速排序是冒泡排序的改进版,也是最好的一种内排序,在很多面试题中都会出现,也是作为程序员必须掌握的一种排序方法。 思想:1.在待排序的元素任取一个元素作为基准(通常选第一个元素,但最的选择方法是从待排序元素中随机选取一个作为基准),称为基准元素; 2.将待排序的元素进行分区,比基准元素大的元素放在它 阅读全文
posted @ 2019-02-18 22:05 ^sun^ 阅读(211) 评论(0) 推荐(0)
摘要: class MyExcept(Exception): def __init__(self, msg): self.message = msg def __str__(self): return self.message try: raise MyExcept("我的异常") except MyExcept as e: prin... 阅读全文
posted @ 2019-02-13 23:39 ^sun^ 阅读(172) 评论(0) 推荐(0)
摘要: try: print("-------") open('123.txt', 'r') except (IOError, NameError): print("######") pass try: open('1.txt','r') except: print("异常") try: # open('1.txt', 'r') p... 阅读全文
posted @ 2019-02-13 23:38 ^sun^ 阅读(116) 评论(0) 推荐(0)
摘要: def replace_string(my_str, *args): """ 替换字符串 :param my_str: :param args: :return: """ print(args) length = len(args) for i in range(0, length-1, 2): new_st... 阅读全文
posted @ 2019-02-13 23:36 ^sun^ 阅读(218) 评论(0) 推荐(0)
摘要: import os root_path1 = r'D:\python_code' file_count = 0 dir_count = 0 def list_files(root_path): """ 遍历目录 :param root_path: :return: """ global file_count, dir_count if... 阅读全文
posted @ 2019-02-13 23:35 ^sun^ 阅读(189) 评论(0) 推荐(0)
摘要: /* ======================================================================== * Bootstrap: modal.js v3.3.5 * http://getbootstrap.com/javascript/#modals * ============================================... 阅读全文
posted @ 2019-01-23 17:12 ^sun^ 阅读(629) 评论(0) 推荐(0)
摘要: 输出结果如下: maven项目中,需要在pom.xml文件的<dependencies>标签下加上对JSONsimple的依赖,如下 <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->< 阅读全文
posted @ 2019-01-09 17:04 ^sun^ 阅读(60474) 评论(0) 推荐(0)
摘要: 输出的结果: 下面是结果:{"b_name":"平平/萍萍","d_reason":"和学成睡一晚,后来学成嘴疼","a_userId":"438","c_sex":"不知男女"} 需要引入的jar包列表: cglib-nodep-2.2.jarcommons-beanutils-1.8.0.jar 阅读全文
posted @ 2019-01-09 15:16 ^sun^ 阅读(9313) 评论(0) 推荐(0)
摘要: 先点击状态栏的help(或者帮助),再点击进入lisence (或者证书),他跳出来一个对话框,你把下面的激活码复制进去就行了 近期Sublime Text 3增加了注册码校验功能,很多使用共享版注册码的朋友都出现了弹窗提醒注册码失效。虽然可以再次进行激活,但很快又会被移除注册。 操作步骤: 1、打 阅读全文
posted @ 2018-12-27 20:48 ^sun^ 阅读(195) 评论(0) 推荐(0)
摘要: function ReplaceSeperator(mobiles) { var i; var result = ""; var c; for (i = 0; i "; else if (c != "\r") result = result + c; } return result; } 阅读全文
posted @ 2018-12-11 20:25 ^sun^ 阅读(999) 评论(0) 推荐(0)