随笔分类 -  Python

摘要:python堆、集合、双端队列 # This is a sample Python script. # 1# 1 # 2# 2 # Press Shift+F10 to execute it or replace it with your code.# 3# 3 # Press Double Shi 阅读全文
posted @ 2024-01-03 10:28 txwtech 阅读(33) 评论(0) 推荐(0)
摘要:39.python list列表的操作 if __name__ == '__main__': #13#13 #print_hi('PyCharm') #14#14 import fileinput #15#15 #for line in fileinput.input(inplace=True): 阅读全文
posted @ 2024-01-03 09:13 txwtech 阅读(29) 评论(0) 推荐(0)
摘要:# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, 阅读全文
posted @ 2024-01-03 08:40 txwtech 阅读(21) 评论(0) 推荐(0)
摘要:最外面的引号是由Python本身使用的,而Windows shell看不到它,Windows只理解双引号。 Python将在Windows上将正斜杠转换为反斜杠,因此您可以使用 exe_path = r'C:\Windows\System32\mspaint.exe' exe_path2 = r'" 阅读全文
posted @ 2024-01-02 13:32 txwtech 阅读(368) 评论(0) 推荐(0)
摘要:if __name__ == '__main__': #print_hi('PyCharm') add_to_log_func('abcdefg') print("read_content:\n", read_file_func()) msg = input('key key for exit... 阅读全文
posted @ 2024-01-02 08:39 txwtech 阅读(46) 评论(0) 推荐(0)
摘要:python创建目录,判断目录是否存在,存在创建时不会报异常 def add_to_log_func(info): global gl_log_file_name log_directory=os.getcwd()+'\\log\\' #os.getcwd()获取当前所在目录 if not os.p 阅读全文
posted @ 2024-01-02 08:30 txwtech 阅读(92) 评论(0) 推荐(0)
摘要:python三元运算,c三目运算符使用 age3 = 10print(age3 > 10 if 'ok' else 'false')print('正常' if age3 > 2 else '异常') 阅读全文
posted @ 2024-01-01 21:22 txwtech 阅读(26) 评论(0) 推荐(0)
摘要:python模块的使用方法_类的创建与调用 eml = employee.Employee() #默认调用模块的__init__.pyemployee文件夹就是模块,与main.py主程序在同一个项目的文件夹main.py # This is a sample Python script. # Pr 阅读全文
posted @ 2024-01-01 21:03 txwtech 阅读(38) 评论(0) 推荐(0)
摘要:pycharm2023增加前进后退到主界面快捷按钮 阅读全文
posted @ 2023-12-30 21:15 txwtech 阅读(347) 评论(0) 推荐(0)
摘要:python,pycharm显示前进后退按钮 阅读全文
posted @ 2023-12-29 22:03 txwtech 阅读(990) 评论(0) 推荐(0)
摘要:python记录时间 python读写文件与全局变量的使用,创建日志文件,记录时间 # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Doub 阅读全文
posted @ 2023-12-29 16:58 txwtech 阅读(57) 评论(0) 推荐(0)
摘要:File "D:/PycharmProjects/pythonProject_file_operation/main_file_op.py", line 14, in add_to_log time2 = time.strftime('%Y-%m-%d %H:%M:%s', time.localti 阅读全文
posted @ 2023-12-29 14:52 txwtech 阅读(117) 评论(0) 推荐(0)
摘要:main.spec 添加: icon='txw_ico128x128.ico'文件放在py文件的相同目录 翻译 搜索 复制 阅读全文
posted @ 2023-12-29 11:20 txwtech 阅读(612) 评论(0) 推荐(0)
摘要:安装方法:pip install PyInstaller pyinstaller -D -c xxx.py # 常用参数说明 -F :生成结果是一个exe文件,所有的第三方依赖、资源和代码均被打包进该exe内 -D :生成结果是一个目录,各种第三方依赖、资源和exe同时存储在该目录 -w :不显示命 阅读全文
posted @ 2023-12-29 11:03 txwtech 阅读(341) 评论(0) 推荐(0)
摘要:python pyinstaller打包exe实现控制台窗体关闭按钮启用与禁用 pycharm直接点run是会报错的: # This is a sample Python script. # Press Shift+F10 to execute it or replace it with your 阅读全文
posted @ 2023-12-29 09:27 txwtech 阅读(433) 评论(0) 推荐(0)
摘要:切换到了一个不同的模块pywinauto,它是由pyinstaller官方支持的,并使用: import pywinauto pywinauto.mouse.double_click(button='left', coords=(0, 0)) 复制 翻译 搜索 复制 阅读全文
posted @ 2023-12-29 09:16 txwtech 阅读(180) 评论(0) 推荐(0)
摘要:pyinstaller打包python程序报错报错信息如下: option(s) not allowed: --onedir/--onefilemakespec options not valid when a .spec file is given 解决:不使用 -F 参数 pyinstaller 阅读全文
posted @ 2023-12-28 15:51 txwtech 阅读(660) 评论(0) 推荐(0)
摘要:ModuleNotFoundError: No module named 'win32gui' 管理员方式CMD打开命令提示符,以管理员权限运行pip install pypiwin32,重新安装 确保main.spec的路径正确: 重新打包: 其它参考:https://www.cnblogs.co 阅读全文
posted @ 2023-12-28 14:41 txwtech 阅读(371) 评论(0) 推荐(0)
摘要:python pycharm设置断点快捷键 CTRL+F8 翻译 搜索 复制 阅读全文
posted @ 2023-12-28 13:28 txwtech 阅读(58) 评论(0) 推荐(0)
摘要:安装 pypiwin32 执行: pip install pypiwin32 翻译 搜索 复制 阅读全文
posted @ 2023-12-28 12:00 txwtech 阅读(26) 评论(0) 推荐(0)