上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 47 下一页
摘要: a = 0b1101 b = 0b1010 print(a, b) # 13 10 # 与 print(bin(a & b)) # 0b1000 # 或 print(bin(a | b)) # 0b1111 # 异或 print(bin(a ^ b)) # 0b0111, 位不同的为1, 相同的为0 阅读全文
posted @ 2023-07-23 21:15 yanghui01 阅读(9) 评论(0) 推荐(0)
摘要: 常见概念 类和对象 class MyClass: num = 0 s = "" def __init__(self): # 构造函数 pass def print_info(self): print("num is: %s, str is: %s" %(self.num, self.s)) pass 阅读全文
posted @ 2023-07-21 01:15 yanghui01 阅读(12) 评论(0) 推荐(0)
摘要: Python中没有专门的queue类,而是把list当作队列来使用。 队列是一种先进先出的数据结构,主要的操作:入队,出队 queue1 = [] queue1.append(1) queue1.append(2) queue1.append(3) print(type(queue1)) # <cl 阅读全文
posted @ 2023-07-21 00:34 yanghui01 阅读(13) 评论(0) 推荐(0)
摘要: Python中没有没专门的stack类,而是可以把list当作栈来用 栈是一种先进后出的数据结构,主要的操作只有:入栈,出栈 stack1 = [] # 入栈 stack1.append(1) stack1.append(2) stack1.append(3) print(type(stack1)) 阅读全文
posted @ 2023-07-21 00:34 yanghui01 阅读(10) 评论(0) 推荐(0)
摘要: 常用操作 dict的key不能重复,不能为可变值;value可以重复 基本使用 dict1 = { "key1": 1, "key2": 2, "key3": 3, } print(type(dict1)) # <class 'dict'> print(type(dict1) == dict) # 阅读全文
posted @ 2023-07-21 00:33 yanghui01 阅读(7) 评论(0) 推荐(0)
摘要: 常用操作 set的元素不能重复 set1 = {1, 2, 3} print(type(set1)) # <class 'set'> print(len(set1)) # 3 # 添加 set1.add(4) print(len(set1)) # 4 # 判断是否在集合中 print(1 in se 阅读全文
posted @ 2023-07-21 00:33 yanghui01 阅读(8) 评论(0) 推荐(0)
摘要: 常用操作 列表的元素可以为空,也可以重复 基本使用 list1 = [1, 2, 3] print(type(list1)) # <class 'list'> print(type(list1) == list) # True print(isinstance(list1, list)) # Tru 阅读全文
posted @ 2023-07-21 00:22 yanghui01 阅读(10) 评论(0) 推荐(0)
摘要: 常用操作 判断类型 print(type("abc")) # <class 'str'> print(type("abc") == str) # True print(isinstance("abc", str)) # True 遍历和长度 print(len("abc")) # 3 for c i 阅读全文
posted @ 2023-07-21 00:09 yanghui01 阅读(29) 评论(0) 推荐(0)
摘要: 基础数据类型 a = 1 print(type(a)) b = 1.2 print(type(b)) c = True print(type(c)) a = c print(type(a)) e = "hello" print(type(e), id(e)) 2进制,8进制,16进制 a=0b101 阅读全文
posted @ 2023-07-20 00:45 yanghui01 阅读(21) 评论(0) 推荐(0)
摘要: Rect内部使用m_XMin, m_YMin, m_Width, m_Height存放数据,即:左下角+宽高 1) 设置xMin, xMax时,宽度m_Width会被修改 设置xMin时,认为是只有左侧在动, 右侧是不动的; 左侧往左则m_Width变大, 左侧往右则m_Width变小 设置xMax 阅读全文
posted @ 2023-07-19 00:46 yanghui01 阅读(28) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 47 下一页