摘要: pip报错 Fatal error in launcher: Unable to create process using 修复办法: python -m pip install pip==9.0.0 然后python -m pip install --upgrade pip 转载自:https:/ 阅读全文
posted @ 2021-11-27 21:10 嗯哈哈 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 练习题1-全局替换程序: 1.写一个脚本,允许用户按以下方式执行时,即可以对指定文件内容进行全局替换 python your_script.py old_str new_str filename2.替换完毕后打印替换了多少处内容 1.txt的内容: 代码: 执行脚本: 修改文件内容的思路: 以读的方 阅读全文
posted @ 2019-07-09 06:28 嗯哈哈 阅读(651) 评论(0) 推荐(0) 编辑
摘要: 编码(encode) 与 解码 ( decode ) str.encode(): bytes.decode(): 阅读全文
posted @ 2019-07-09 06:04 嗯哈哈 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 我先把1.txt的内容贴出来: 安装方式 :pip3 install chardet 解释: 阅读全文
posted @ 2019-07-09 05:51 嗯哈哈 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1 # @Time :2019/6/22 18:43 2 # -*- encoding:utf-8 -*- 3 ''' 4 class Base(object): 5 def f1(self): 6 print("Base") 7 super().f1() 8 class Bar(): 9 def f1(self): 10... 阅读全文
posted @ 2019-07-05 18:09 嗯哈哈 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 # @Time :2019/6/21 14:51 2 #-*- encoding:utf-8 -*- 3 4 5 # 第一题: 6 # 7 # class StarkConfig(object): 8 # list_display = [] 9 # 10 # def get_list_display(self): 11 # ... 阅读全文
posted @ 2019-07-05 18:08 嗯哈哈 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1 # @Time :2019/6/17 16:00 2 # -*- encoding:utf-8 -*- 3 4 data_list = [] 5 for i in range(1, 901): 6 data_list.append('alex-%s' % i) 7 8 9 class Page: 10 ''' 11 处理分页相关的代码 ... 阅读全文
posted @ 2019-07-05 18:04 嗯哈哈 阅读(322) 评论(0) 推荐(0) 编辑
摘要: db-ban.txt 代码: 阅读全文
posted @ 2019-07-05 17:58 嗯哈哈 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 1 # 1.用你能想到的最少的代码生成一个包含100个key的字典,每个value的值不能一样 2 ''' 3 # import random 4 key = {} 5 for i in range(100): 6 key.setdefault(i,i) 7 # key.setdefault(random.randrange(101),random.randrang... 阅读全文
posted @ 2019-07-05 17:49 嗯哈哈 阅读(739) 评论(0) 推荐(0) 编辑
摘要: 1 # @Time :2019/6/6 19:04 2 #-*- encoding:utf-8 -*- 3 menu = { 4 '北京':{ 5 '海淀':{ 6 '五道口':{ 7 'soho':{'没有了,输入q退出,b返回'}, 8 '网易':{'没有了... 阅读全文
posted @ 2019-07-05 17:45 嗯哈哈 阅读(86) 评论(0) 推荐(0) 编辑