随笔分类 - python学习
1
开启学习PYTHON之路
摘要:使用python GUI绘制一个桌面应用,多选内容,有提交按钮和清空按钮 1 import tkinter as tk 2 3 def show_hobby(): 4 selected_hobbies = [] 5 for hobby, var in hobbies_vars.items(): 6
阅读全文
摘要:编写一个server.py文件 1 import http.server 2 import socketserver 3 4 PORT = 8000 5 6 Handler = http.server.SimpleHTTPRequestHandler 7 8 with socketserver.TC
阅读全文
摘要:相关插件自己提前安装好。 代码: 1 #encoding:utf-8 2 3 from tkinter import * 4 from tkinter import messagebox 5 import win32print 6 import time 7 from tkinter import
阅读全文
摘要:1 #encoding:utf-8 2 3 from tkinter import * 4 from tkinter import messagebox 5 import win32print 6 import time 7 from tkinter import scrolledtext 8 9
阅读全文
摘要:# 操作思路: # 1.打开指定的TXT # 2.读取TXT中的内容 # 3.处理数据 # 4.将内容存放在数组中 # 5.打印数组中的数据 def print_hi(name): print(f'Hi, {name}') with open('TNS.txt', 'r') as file: dat
阅读全文
摘要:1 # encoding:utf-8 2 3 from tkinter import * 4 from tkinter import messagebox 5 from tkinter import filedialog 6 import pandas as pd 7 ''' 8 画图形界面,供us
阅读全文
摘要:1 # encoding:utf-8 2 3 from tkinter import * 4 from tkinter import messagebox 5 from tkinter import filedialog 6 7 ''' 8 画图形界面,供user操作 9 界面功能: 10 1.US
阅读全文
摘要:1 # encoding:utf-8 2 3 import pandas as pd 4 from openpyxl import load_workbook 5 6 ''' 7 本案例获取所有符合的列数据 8 去除了每个栏位的空格 9 去除了空行数据 10 去除了第一列为空的整行数据 11 多个s
阅读全文
摘要:1 # encoding:utf-8 2 3 import pandas as pd 4 from openpyxl import load_workbook 5 6 ''' 7 本案例获取所有符合的列数据 8 去除了每个栏位的空格 9 去除了空行数据 10 去除了第一列为空的整行数据 11 多个s
阅读全文
摘要:1 def openxls(self): 2 '''获取第一个sheet的数据''' 3 df = pd.read_excel(self.filepath, sheet_name=0) 4 '''获取行数列数''' 5 hanglie = df.shape 6 hang = hanglie[0] 7
阅读全文
摘要:1 # encoding:utf-8 2 3 import pandas as pd 4 ''' 5 整合sheet 6 将符合的列放在第一个sheet 7 将符合的列放在第二个sheet 8 ''' 9 10 class OpenMyXLS(): 11 def __init__(self, fil
阅读全文
摘要:# encoding:utf-8 import pandas as pd class OpenMyXLS(): def __init__(self, filepath): self.filepath = filepath self.openxls() def openxls(self): df =
阅读全文
摘要:1 # encoding:utf-8 2 3 import pandas as pd 4 5 class OpenMyXLS(): 6 def __init__(self, filepath): 7 self.filepath = filepath 8 self.openxls() 9 10 def
阅读全文
摘要:1 # encoding:utf-8 2 3 import pandas as pd 4 5 6 class QuChongFu(): 7 def __init__(self): 8 self.qcfxls() 9 10 def qcfxls(self): 11 # 读取excel中的数据 12 d
阅读全文
摘要:#encoding:utf-8 """ 目标:将一组数组写入倒XLS文件中 """ import xlwt class myWriteXls(): def __init__(self,filename): self.filename = filename self.writexls() def wr
阅读全文
摘要:#encoding:utf-8 ''' 目标:读取XLS文件中的内容 步骤: 1.打开已有XLS文件 2.获取sheet名称 3.获取对应sheet第一行数据 4.获取其他行数据 ''' import xlrd '''打开文件''' class OpenMyXLS(): def __init__(s
阅读全文
摘要:Oracle专有的插入数据报错: 出错的语句为: sql = "insert into mytable values(%s,%s,%s)" cursor.execute(sql, data) 结果就出现了“ORA-01036: 非法的变量名/编号”的错误。 解决方法: 将传参的占位符改为 “:1,
阅读全文
摘要:from oracletest1 import MyOracle import xlwt import datetime name='xxx' password='xxx' tnsname='xxx' #连接数据库 myo = MyOracle(name,password,tnsname) #建立指
阅读全文
摘要:#encoding:utf-8 import cx_Oracle #name='admin' #password='admin' #tnsname='admin' #创建我的封装数据库类 class MyOracle(): #初始化数据库参数:使用者,密码,数据库 def __init__(self
阅读全文
摘要:官方下载python安装包。 网址:欢迎来到 Python.org 下载完之后: 双击,点击安装: Install Now:表示按照默认路径安装 Customize installation:改成你想要安装的路径 安装成功后: 在开始菜单里就会有安装好的python程序: 打开这个IDLE编辑器,就
阅读全文
1