1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。
访问量(1130509) 积分(1523) 等级(核心会员) 排名(6)
python文件转换为exe文件 很多时候python做了个程序只能自己用,那么如何复制的其他服务器上并允许。 1、运行cmd 2、输入pip install pyinstaller安装模块。 3、制作个python的文件,最后要有个input函数,否则会闪退。或者用time函数停顿也行。之后保存路径。 4、在cmd的DOS界面中输入,cd /d D:/pycharm ,切换到文件存放的需要的文件夹(根据...
2023-07-20 16:55 906 0
from win32com.client.gencache import EnsureDispatch from win32com.client import constants Excel = EnsureDispatch("Excel.Application") # 打开Excel程序 f = r"D:/pythonProject1/tmp_记账凭单模板.xlsx" wb = Excel.Workbooks.Open(f) # 打开Excel工作簿 sht = wb.Sheets("Sheet1") # 指定工作表 sht.PrintOut() # 打印工作表...
2023-07-07 15:33 872 0
import tkinter as tk from main_tk import root def onclick(event): results = ask_text.get() print(results) f = open('bb.txt', 'w') f.write(results) f.close() # print(ask_text.get()) def tk_button(): root = tk.Tk() root.geometry("500x300") l1 = tk.Lab
2023-07-06 10:53 751 0
import win32print import win32api import win32ui import win32con win32api.ShellExecute( 0, "print", 'data.txt', # 打开需要打印的文件 '/d:"%s"' % win32print.GetDefaultPrinter(), # 找到windows 连接的默认打印机 ".", 0 )
2023-07-06 09:11 1020 0
import base64 from PIL import Image from io import BytesIO #base64_str="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbYAAAD1CAYAAAA8stAGAAAAAXNSR0IArs4c6QAAIABJREFUeF7s3QeYplV5N/BnGwZEg0psxK6xRLFGsSsGFdCoa2JDjVEjTWzYCxoFOzYsgIpYItg1YsRoVCyxx5ZYgEhMPhXUgAmKUnb3u35n5z+ePfvWmXfYnZ3nXNdcM/O+TznnP
2023-07-05 16:07 825 0
$cat 4.py #!/usr/bin/env pythpn import datetime now = datetime.datetime.now() date_now = now.date() def get_date_month(mon=0): last_m = (int(now.year) * 12 + int(now.month) - mon) % 12 if len(str(last_m)) == 1: last_m = "%02d" % last_m last_y = int((int(now.year) * 1
2022-07-29 19:07 1268 0
1.Python代码 def register(): username = input('输入用户名:') if len(username) < 6: raise Exception('用户长度必须6位以上') else: print('请输入用户名是:', username) try: register() except Exception as err: print(err) print('注册失败') else: print('注册成功') ...
2022-03-03 21:38 1207 0
def func(): try: n1 = int(input("Please input the firest one:")) n2 = int(input("Please input the secend one:")) per = input("Please input + - * /") result = 0 if per == '+': result = n1 + n2 elif per == '-': result
2022-03-03 21:02 1069 0
在处理字符串之间存在多个空格的时候,不按照一个空格来分隔,而是按照空白来分隔。 import re list1 = "a b c d e f" print("re", re.split(r"[ ]+", list1)) 输出结果: re ['a', 'b', 'c', 'd', 'e', 'f']
2022-03-03 08:43 1390 0
############################################################################################################### # Script name: db2pd_immmdb_tab.py # Script description: Get "db2pd -d <dbname> -tab" information # Current Release Version: 1.0.0 # Script Owner: He ,Haibo # Latest editor: He,
2022-03-03 08:32 1167 0
Python代码 def func(): try: n1 = int(input("Please input the firest one:")) n2 = int(input("Please input the secend one:")) per = input("Please input + - * /") result = 0 if per == '+': result = n1 + n2 elif per == '-':
2022-03-02 21:48 928 0
装饰器(decorator),又称“装饰函数”,即一种返回值也是函数的函数,可以称之为“函数的函数”。其目的是在不对现有函数进行修改的情况下,实现额外的功能。最基本的理念来自于一种被称为“装饰模式”的设计模式。 1.Python源码 def func(number): a = 100 def inner_func(): nonlocal a for i in range(number)...
2022-02-17 22:02 909 0
[root@ansible ~]# yum -y install gcc-* openssl-* libffi-devel sqlite-devel [root@ansible ~]# vi /tmp/Python-3.6.15/Modules/Setup _ssl _ssl.c / -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl / -L$(SSL)/lib -lssl -lcrypto [root@ansible Python-3.6.15]# ./configure --prefix=/
2022-02-17 21:24 1016 0
Python strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 实例一: #!/usr/bin/python # -*- coding: UTF-8 -*- str = "00000003210Runoob01230000000"; print str.strip( '0' ); # 去除首尾字符 0 str2 = " Runoob "; # 去...
2022-02-14 07:59 955 0
1.Python代码 def add(a, b=1, c=2): result = a + b + c print(result) def main(): add(3) add(3, 8) add(3, c=4) if __name__ == "__main__": main() 2.执行效果 6 13 8
2022-02-13 09:31 1031 0