摘要: 【WPF】三、控件模板 阅读全文
posted @ 2022-08-27 21:13 xxxyz 阅读(22) 评论(0) 推荐(0) 编辑
摘要: <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/200 阅读全文
posted @ 2022-08-26 22:09 xxxyz 阅读(37) 评论(0) 推荐(0) 编辑
摘要: <Window x:Class="WpfApp1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/x 阅读全文
posted @ 2022-08-26 22:07 xxxyz 阅读(33) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*- from enum import Enum, unique # 1. 枚举的定义 # 首先,定义枚举要导入enum模块。 # 枚举定义用class关键字,继承Enum类。 # 2. 如果要限制定义枚举时,不能定义相同值的成员。 # 可以使用装饰器@un 阅读全文
posted @ 2022-08-26 21:22 xxxyz 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 精简易懂yield解释。 yield可以理解为return,但是区别于return的是yield之后,还可以继续执行接下来的一系列行为。 return后的内容无法执行了,并且yield返回的是生成器,return是返回的结果类型。 # -*- coding: utf-8 -*- def SayDuc 阅读全文
posted @ 2022-08-26 11:52 xxxyz 阅读(52) 评论(0) 推荐(0) 编辑
摘要: def quicksort(array): less = [] greater = [] if len(array) <= 1: return array pivot = array.pop() for x in array: if x <= pivot: less.append(x) else: 阅读全文
posted @ 2022-08-17 17:33 xxxyz 阅读(12) 评论(0) 推荐(0) 编辑
摘要: class Course9: def Test1(self=0): word = "This's a test" # print(type(word)) i = len(word) while i > 0: print(word[0:i - 1]) i -= 1 def Test2(self=Non 阅读全文
posted @ 2022-08-02 15:47 xxxyz 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 相信学Python的小伙伴肯定有这样的尴尬局面,给一个函数不会用, 原因是:不知道参数列表中的类型是什么意思,比如初学者都会疑问的:*args和**kwargs到底是怎么用。 当你知道这个时,我猜你肯定能会用好多函数了! #*args的用法:当传入的参数个数未知,且不需要知道参数名称时。 def f 阅读全文
posted @ 2022-07-28 14:44 xxxyz 阅读(60) 评论(0) 推荐(0) 编辑
摘要: -> 常常出现在python函数定义的函数名后面,为函数添加元数据,描述函数返回的类型。 : 表示参数的类型建议符 #Python中def函数右侧有个->的含义 def test1(agent: str) -> str: print("Annotations:", test1.__annotatio 阅读全文
posted @ 2022-07-27 12:00 xxxyz 阅读(706) 评论(0) 推荐(0) 编辑
摘要: 一、 defaultdict 是内建 dict 类的子类,它覆写了一个方法并添加了一个可写的实例变量。其余功能与字典相同。 defaultdict() 第一个参数提供了 default_factory 属性的初始值,默认值为 None,default_factory 属性值将作为字典的默认数据类型。 阅读全文
posted @ 2022-07-20 09:56 xxxyz 阅读(43) 评论(0) 推荐(0) 编辑