摘要: ##小程序,计算一个字符串中每个字符出现的次数+ import pprint message = 'It was a bright cold day in April, and the clocks were striking thirteen.' count = {} for character in message: count.setdefault(character, 0) ... 阅读全文
posted @ 2019-03-13 16:14 晨光曦微 阅读(672) 评论(0) 推荐(0) 编辑
摘要: ''' picnicItems 野餐用品清单 picnicItems sandwiches.................... 4apples........................ 12cups.......................... 4cookies........... 阅读全文
posted @ 2019-03-13 16:13 晨光曦微 阅读(219) 评论(0) 推荐(0) 编辑
摘要: def boxPrint(symbol, width, height): if len(symbol) != 1: raise Exception('Symbol(符号) must be a single character string.') if width <= 2: raise Exception('Width must be greate... 阅读全文
posted @ 2019-03-13 16:12 晨光曦微 阅读(312) 评论(0) 推荐(0) 编辑
摘要: birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} while True: print('Enter a name: (blank to quit)') name = input() if name == '': break if name in birthdays: ... 阅读全文
posted @ 2019-03-13 16:09 晨光曦微 阅读(226) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2019-03-13 16:06 晨光曦微 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import requests from pyquery import PyQuery as pq url='http://www.51xxx.com/Try/index/p/3' headers={ 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chro... 阅读全文
posted @ 2019-03-13 16:03 晨光曦微 阅读(558) 评论(0) 推荐(0) 编辑
摘要: A.右键.py文件,edit with idle B.如果没有这个选项: 选择打开方式,进入python安装路径,选择 Python37\Lib\idlelib\idle.bat 阅读全文
posted @ 2019-03-13 15:56 晨光曦微 阅读(5665) 评论(3) 推荐(2) 编辑
摘要: ''' 【生产者】正在生产 1 中......【消费者】正在消费 1 中...【生产者】消费者返回了:OK,完成消费!! !【生产者】正在生产 2 中......【消费者】正在消费 2 中...【生产者】消费者返回了:OK,完成消费!! !【生产者】正在生产 3 中......【消费者】正在消费 3 阅读全文
posted @ 2019-03-13 15:35 晨光曦微 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 自学《Python编程快速上手》P232的内容,运行下面代码时,程序报错 问题分析: openpyxl的后续版本有所修改,此外,《Python编程快速上手》的原著作者后续也已对该内容做了修改。 见链接:https://automatetheboringstuff.com/chapter12/ 正确代 阅读全文
posted @ 2018-11-29 14:33 晨光曦微 阅读(3970) 评论(0) 推荐(0) 编辑
摘要: 20.如何写一个正则表达式,匹配每 3 位就有一个逗号的数字?它必须匹配以下数字:'42''1,234''6,368,745'但不会匹配: '12,34,567' (逗号之间只有两位数字) '1234' (缺少逗号) 正确match写法 : 正确findall写法: 综上,上机实际验证写法应为: 附 阅读全文
posted @ 2018-11-10 16:27 晨光曦微 阅读(322) 评论(0) 推荐(0) 编辑