06 2021 档案

摘要:def fab(max): n, a, b = 0, 0, 1 while n < max: print(b) a = b b = a + b n = n + 1 fab(10) 输出 1 1 2 4 8 16 32 64 128 256 而 def fab(max): n, a, b = 0, 0 阅读全文
posted @ 2021-06-23 16:51 Gex 阅读(256) 评论(0) 推荐(0)
摘要:今天有学了,记录下 all(iterable) 描述 all() 函数用于判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False。 元素除了是 0、空、None、False 外都算 True。 函数等价于: def all(iterable 阅读全文
posted @ 2021-06-23 11:32 Gex 阅读(150) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/lincappu/p/12801817.html 阅读全文
posted @ 2021-06-23 00:16 Gex 阅读(44) 评论(0) 推荐(0)
摘要:该模块提供了许多对文件和文件集合的高级操作。特别是提供了支持文件复制和删除的功能。对于单个文件的操作,另见 模块。shutilos shutil.copyfile( src , dst , * , follow_symlinks=True ) 将名为src的文件的内容(无元数据)复制到名为dst的文 阅读全文
posted @ 2021-06-22 23:51 Gex 阅读(145) 评论(0) 推荐(0)
摘要:Python的sys模块提供访问由解释器使用或维护的变量的接口,并提供了一些函数用来和解释器进行交互,操控Python的运行时环境。 sys.argv 传递给程序的命令行参数列表;其中,sys.argv[0]表示脚本名称,各个参数均为字符串类型。 sys.exit(n) 程序退出,如果是正常退出是s 阅读全文
posted @ 2021-06-22 23:22 Gex 阅读(84) 评论(0) 推荐(0)
摘要:try: 可能出现异常的代码 except 异常类型: 捕获到异常之后的处理方案 finally: 不管try里有没有异常它都会执行 try: # try下面写有可能会出现异常的代码 score = int(input("请输入成绩:")) # 因为input获取的都是字符串,int()是强制转换成 阅读全文
posted @ 2021-06-22 17:48 Gex 阅读(147) 评论(0) 推荐(0)
摘要:python里面的os模块有许多方法可以让我们通过代码实现创建,删除和更改目录 整理自菜鸟教程网 os.access(path, mode) 概述 os.access() 方法使用当前的uid/gid尝试访问路径。大部分操作使用有效的 uid/gid, 因此运行环境可以在 suid/sgid 环境尝 阅读全文
posted @ 2021-06-22 17:35 Gex 阅读(149) 评论(0) 推荐(0)
摘要:open(file, mode='r') 完整的语法格式为: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 参数说明: file: 必需, 阅读全文
posted @ 2021-06-09 14:56 Gex 阅读(125) 评论(0) 推荐(0)
摘要:使用PyQt5做UI,我一直使用QTextBrowser作为LOG的输出界面。不知道对不对。感觉QTextBrowser是文本浏览器,就像txt一样是查看文本的。字面意思吧,好吧,我英文不好 QTextBrowser刷新 上代码 def text_browser_show(self, mes): s 阅读全文
posted @ 2021-06-09 14:14 Gex 阅读(7615) 评论(0) 推荐(0)
摘要:看别人的GUi界面的状态栏都有许多控件,感觉很Nice,网上找了些,感觉还是自己写一个号点。 上代码: import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import QTimer class StatusDemo(QMainWin 阅读全文
posted @ 2021-06-09 10:28 Gex 阅读(2809) 评论(0) 推荐(1)
摘要:def print(self, *args, sep=' ', end='\n', file=None): # known special case of print """ print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=Fa 阅读全文
posted @ 2021-06-03 00:10 Gex 阅读(225) 评论(0) 推荐(0)