🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## PyCharm 快捷键 ![](https://img.kancloud.cn/c8/38/c838bbc5b03287642d824747d0f160e2_439x311.png) ![](https://img.kancloud.cn/da/08/da08ba5a5aa7fcad520417f246cb5542_575x92.png) ## 字符串 ![](https://img.kancloud.cn/86/cb/86cb1b05ddb53d316ff4dd98cf201e86_1001x432.png) ### 占位符 ![](https://img.kancloud.cn/18/5a/185a3220f9834e914aa509fb0e139044_750x162.png) ## 列表 ![](https://img.kancloud.cn/b2/81/b2813cf6da00813367d2fbbe4ae5ca6b_851x316.png) ### 特点 ![](https://img.kancloud.cn/38/f9/38f91fc10a5052a7a98c9dba41de0e73_624x311.png) ## 元组 ![](https://img.kancloud.cn/63/aa/63aaadfcd1bd3ff268035df6b41cce5d_565x181.png) ## 序列 ![](https://img.kancloud.cn/b9/03/b903b792033ee4f79619a1d9295526ca_570x314.png) ### 切片 ![](https://img.kancloud.cn/39/d7/39d723fa68ef982997e9438cf37a8c69_589x373.png) ## 集合 ![](https://img.kancloud.cn/80/2d/802dbc1c63dc24449de023658457b452_1011x437.png) ### 特点 ![](https://img.kancloud.cn/f2/44/f244a00690d14f7ab1d1477fa90163dc_483x238.png) ## 字典 ![](https://img.kancloud.cn/a2/8f/a28fb20640da4c8810ad65469e22c870_1024x312.png) ### 特点 ![](https://img.kancloud.cn/8d/66/8d667dd45a34305cc333c57525a8858d_551x279.png) ## 数据容器对比 ![](https://img.kancloud.cn/cc/8d/cc8d2057730023ecaf13e989409cabc3_1008x402.png) ## 容器通用操作 ![](https://img.kancloud.cn/1c/58/1c58487fd82e3190e40a1aa0951006da_994x457.png) ## 函数多种参数 ![](https://img.kancloud.cn/c8/46/c846251d6e9a6579286b232e02a1b1b5_581x398.png) ## 文件 ![](https://img.kancloud.cn/d2/c3/d2c30d915a280cbbaa7323ee7b55cd07_923x315.png) ![](https://img.kancloud.cn/f4/b7/f4b768cb14779f8dc8f25b1b18ac2cb7_417x274.png) ## JSON ![](https://img.kancloud.cn/f7/d2/f7d22b56bb89fa3ea53b49d79348b753_665x205.png) ## 多线程 ~~~ import threading thread_obj = threading.Thread([group [, target [, name [, args [, kwargs]]]]]) - group: 暂时无用,未来功能的预览参数 - target: 执行的目标任务名 - args: 以元组的方式给执行任务传参 - kwargs: 以字典方式执行任务传参 - name: 线程名,一般不用设置 thread_obj.start() ~~~ ## 闭包 ~~~ def atm(account_amount): def change(num, deposit=True): nonlocal account_amount if deposit: account_amount += num print(f"存款金额:{num},账户余额:{account_amount}") else: if account_amount < num: print(f"账户余额不足,剩余:{account_amount}") return None account_amount -= num print(f"取款金额:{num},账户余额:{account_amount}") return change f = atm(1000) f(500, False) f(500, False) f(500, False) f(500, False) f(500) f(500) f(500) # 取款金额:500,账户余额:500 # 取款金额:500,账户余额:0 # 账户余额不足,剩余:0 # 账户余额不足,剩余:0 # 存款金额:500,账户余额:500 # 存款金额:500,账户余额:1000 # 存款金额:500,账户余额:1500 ~~~ ## 装饰器 ~~~ def outer(func): def inner(): print("睡觉了") func() print("起床了") return inner @outer def sleep2(): print("睡jiao中。。。") time.sleep(random.randint(1, 5)) sleep2() # 睡觉了 # 睡jiao中。。。 # 起床了 ~~~