共 18 篇文章 |
|
检验你 Python 基本功的 17 个骚操作。此外,Python 的编写使用方式有多种,数据科学、网页开发、机器学习皆可使用 Python。2、 将列表中的所有元素组合成字符串。4 检查两个字符串是不是由相同字母不同顺序组成。5、 反转字符串。11、 字典 get 方法。12、 通过「键」排序字典元素。15、 合并字典。17、 移除列表中的重复元素。 阅36 转1 评0 公众公开 19-10-02 21:02 |
def has_duplicates(lst): return len(lst) !from copy import deepcopyfrom random import randintdef shuffle(lst): temp_lst = deepcopy(lst) m = len(temp_lst) while (m): m -= 1 i = randint(0, m) temp_lst[m], temp_lst[i] = temp_lst[i], temp_lst[m] return temp_lst foo = [1,2,3]shuffle(foo) # [2,3,1] , foo = [1,2,3]28.列表扁... 阅391 转1 评0 公众公开 19-09-27 21:21 |
if 条件表达式1: 操作语句1elif 条件表达式2: 操作语句2else: 操作语句3.Python使用try语句处理异常,该语句一般包括try、except和else三个句式,组成try-except-else的形式。try: 操作语句1except 错误类型1: 操作语句2except 错误类型2: 操作语句3else: 操作语句4.但要注意,else语句的存在必须以except语句的存在为... 阅44 转3 评0 公众公开 19-09-10 06:11 |
mon=float(input(''''''''请输入利润金额:''''''''))mm=0.0#奖金if mon>0 and mon<=10: mm=mon*0.1elif mon<20: mm=1+(mon-10)*0.075elif mon<40: mm=1+0.75+(mon-20)*0.05elif mon<60: mm=1+0.75+1+(mon-40)*0.03elif mon<=100: mm=1+0.75+1+1.2+(mon-60)... 阅184 转3 评0 公众公开 19-08-30 20:53 |
''''''''''''''''''''''''def tm001(): '''''''''''''''''''''''' 【个人备注】:按题意直接写出来 '''''''... 阅347 转5 评0 公众公开 19-08-29 06:56 |
1 抓包工具Fiddler的配置及使用1)工作原理客户端和服务器之间建立一个代理服务器,监听本机发出的请求和服务器返回的响应结果。而Fiddler是c#开发(微软出品,主要作者Eric Lawrence)的http代理服务器,fiddler工作于七层中的应用层,能够捕获到通过的http(s)请求。2)下载地址这是官网:http://www.telerik.com/fiddler你也可以在公众号【小... 阅137 转0 评0 公众公开 19-08-24 23:13 |
python marker.py -f ./input/baby.jpg -m python实用宝典。python marker.py -f ./input/baby.jpg -m python实用宝典 -c #232862.python marker.py -f ./input/baby.jpg -m python实用宝典 -c #232862 --opacity 0.08.python marker.py -f ./input -m python实用宝典 -c #232862 --o.如图,你只要将新的字体文件放到font文件夹下,然后修改TTF... 阅771 转4 评0 公众公开 19-08-24 23:02 |
os.makedirs(path + ‘/tupian’)os.makedirs(path + ‘/wendang’)#建立路径path = “F:/A”os.makedirs(path + ‘/tupian’)os.makedirs(path + ‘/wendang’)#移动文档文件for p in wendang_list: wendang_path = path + ''''''''/'''''''' + p wendang_files = os.li... 阅267 转2 评0 公众公开 19-08-23 17:00 |
实例5:用Python批量生成word版邀请函。# 2.批量填字,存为不同的word文件import docx #导入处理word的库,无耻地直接使用别人造好的轮子doc=docx.Document(''''''''data/邀请函.docx'''''''')for name in names: doc.paragraphs[1].runs[2].text=name doc.save(''... 阅1565 转13 评0 公众公开 19-08-23 16:59 |
Python 文件操作,编程练习题实例六十一.题目:假如要读取的test.txt文件内容如下:举例:test.txt文件中有如下内容:PythonPerl.file1 = open(''''''''test.txt'''''''', ''''''''r'''''''')list1 = [] # ... 阅889 转3 评0 公众公开 19-08-23 16:57 |