随笔分类 - python学习
python学习
摘要:# -*- coding: utf-8 -*-import pymongo, openpyxl, time# pymongo#条件删选mongodb数据def mongodb_expoter(db_name, col_name, **kwargs): mongodb_string = "mongod
阅读全文
摘要:# -*- coding: utf-8 -*-import tkinter as tkdef getNewCreate(): passdef getCharcount1(sss): # 添加字数统 status_str_var.set( '字符数: {count}'.format(count=len
阅读全文
摘要:# 获取输入框中的内容 def getVars(): global outterDomain1, innertDomian1, guestEid1, appName1, unicodeName1, rabbimqVip1 print(outterDomain1, innertDomian1, gue
阅读全文
摘要:#1. xls文件转换成xlsx文件,需要使用到 win32com from win32com import client as wc filepath = "D:\\python\\liyuzhuopan\\s14\\20220531" # xls 转化成xlsxdef convert_Xsl_T
阅读全文
摘要:# -*- coding: utf-8 -*-username = "liyuzhoupan"password = "123"def author(wrappreType): print("wrappreType:", wrappreType) def outterwrapper(func): de
阅读全文
摘要:# -*- coding: utf-8 -*-# decorator# 定义:本质是函数,就是为其他函数添加附件功能# 原则:# 1.不能修改被装饰的函数的源代码# 2.不能修改被装饰的函数的调用方式# 实现装饰器# 1.函数既变量# 2.高阶函数# 3.嵌套函数# 高阶甘薯+嵌套函数 >装饰器im
阅读全文
摘要:# -*- coding: utf-8 -*-# 回参函数def test01(): return 0# 以元组返回参数def test02(): return 1, [1, 2, 3, 4, 5], {"name": "liyuzhoupan"}# 有参函数def test03(x, y): pr
阅读全文
摘要:# -*- coding: utf-8 -*-import sys, time# 读文件:一次性读取所有内容#r=readf = open("singe.txt", 'r', encoding="utf-8").read()print(f)# 写文件,覆盖原来的文件# w=writef1 = ope
阅读全文
摘要:# -*- coding: utf-8 -*-# 列表的特性:1,去重;2.关系测试list1 = [1, 4, 6, 8, 7, 8, 9]# 集合去重list2 = set(list1)print(list2)list4 = [1, 3, 5, 7, 9, 11]list3 = set(list
阅读全文
摘要:# -*- coding: utf-8 -*-import os'''用户入口:1. 商品信息存在文件里2. 已购商品,余额记录商家入口1. 可以添加商品,修改商品价格商品信息:commdList.txt华为手机,8888iphon, 2222bike, 8888用户信息:userinfo.txtL
阅读全文
摘要:# -*- coding: utf-8 -*-dict1 = {"name": "liyuzhoupan", "age": "22", "level": "3"}dict2 = {"name": "LiYuZhou", "age": "32", "level": "6", "students": T
阅读全文
摘要:# -*- coding: utf-8 -*-import sys,timestr1 = "my name is liyuzhoupan"# 首字母大写print(str1.capitalize())# 统计字符串中的字符出现的次数print(str1.count("n"))# 自动补齐多少位,不够
阅读全文
摘要:# -*- coding: utf-8 -*-'''1.启动程序后让用户输入消费额,然后打印商品列表'2.允许用户根据商品编码购买商品3.用户选择商品后,检测余额是否够,够则直接扣款,不够就提醒4.可以随时退出,退出时,打印已购买的商品和余额'''# 定义商品列表global commodListc
阅读全文
摘要:# -*- coding: utf-8 -*-import copy# 浅copy# 使用场景,比如A,B夫妻共有一个银行账户,存取马宁的数据username = ["name", ["saving", 1000]]zhangsan = copy.copy(username)zhangfuren =
阅读全文
摘要:# -*- coding: utf-8 -*-# 列表操作names = ["LiSi", "ZhangSan", "WangWu"]print(names[:])# 增names.append("MaZi")print(names)# 位置增names.insert(1, "ZhaoSi")pri
阅读全文
摘要:# -*-coding: utf-8 -*-name = 'liyuzhoupan'password = '123'def login_test(): count = 0 while count < 3: _name = input("please input your name:\n") _pas
阅读全文