![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python笔记
飞蓬heart
这个作者很懒,什么都没留下…
展开
-
作业20220208
# 一、魔术方法作业 # 设计一个类能让两个列表使用比较运算符的形式进行比较。 # List1 = [1,2,3,[1,2],’a’] # List2 = [1,[‘1’,8],,[1,2],’a’] # 注意:只关注列表中的数字类型元素,不包含字符串 # 如List1 > List2 1+2+3+1+2>1+8+1+2 返回false # List1 < List2 1+2+3+1+2<1+8+1+2 返回True # List1 == List2 1+2+3+1+2==1+原创 2022-02-08 16:07:17 · 920 阅读 · 0 评论 -
【python 高级编程】
num=[1,2,3] #列表推导式 myvec=[[x,x*2] for x in num] #列表推导式:[[1, 2], [2, 4], [3, 6]] # 返回生成器节省内存 myvec=([x,x*2] for x in num) #<generator object <genexpr> at 0x0000020E7EE4D970> # zip拉链操作 # 同时遍历三个数组 x = [[1], 2, 3, 4, 5] y = ['a', 'b', 'c', 'd'原创 2022-01-20 11:35:25 · 603 阅读 · 0 评论 -
Python读取excel数据并转换表达形式
import xlrd class Read_Ex(): def read_excel(self): #打开excel表 book = xlrd.open_workbook("../Data/data.xlsx") #找到sheet页 table = book.sheet_by_name("Sheet1") #获取总行数总列数 row_Num = table.nrows col_Nu.原创 2020-06-22 14:05:12 · 572 阅读 · 0 评论 -
python 签名加密 解密 验签
import base64 import rsa from time import time from Crypto.PublicKey import RSA from Crypto.Hash import SHA from Crypto.Signature import PKCS1_v1_5 from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5 class EncryptedSignature(object): def init(self):原创 2021-11-30 13:38:43 · 537 阅读 · 0 评论 -
Python对象实例化中变量的互相影响
编程过程中发现了一个问题,问题如下: class MyClass(object): def __init__(self,lis=[]): self.num = 0 self.lis = lis classInit1 = MyClass() classInit1.num = 1 classInit1.lis.append(1) classInit2 = MyClass() classInit2.num = 2 classInit2.lis..原创 2020-12-13 10:41:41 · 823 阅读 · 0 评论