随笔分类 -  python求学之路

学python才开通的
 
pymysql python 操作mysql
摘要:import pymysql conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='work') cursor = conn.cursor()#创建游标 #增加单个 # r = cursor.e 阅读全文
posted @ 2020-03-03 06:30 三道_python 阅读(199) 评论(0) 推荐(0)
mysql lift join 简单的三联表查询
摘要:非常感谢老师! 看图吧 班级表 创建及添加数据 在此省略... 创建student表 create table student( sid int not null auto_increment primary key, sname varchar(30), gender enum('男','女') 阅读全文
posted @ 2020-02-29 11:33 三道_python 阅读(1017) 评论(0) 推荐(0)
python web简易框架体验
摘要:———————— ————data #保存class类及类中的对象 ————int #执行程序 ———————————— #@Time:2020/2/4 16:48 #@Author :jok #@file :data.py #@software:PyCharm class web: def hom 阅读全文
posted @ 2020-02-04 17:04 三道_python 阅读(211) 评论(0) 推荐(0)
python logging模块写入中文,文件乱码的解决方法
摘要:一下文件执行将产生乱码,切.log文件显示问好,打不开 import logging def shop_logging(name): name = name+"登录成功!" logger = logging.getLogger() fh = logging.FileHandler("test.log 阅读全文
posted @ 2020-02-02 18:31 三道_python 阅读(4188) 评论(0) 推荐(2)
python 模块,包,变量的调用方法
摘要:#模块用来组织函数的 #包是用来组织模块的 #判断是否为包,主要是看是否有_init_.py #bin与bao有什么关系 #调用模块或者包的方法一览 # import time,sys 系统模块可以直接调用,用“,”分割 # import calculte 调用同文件夹的模块,使用方法calcult 阅读全文
posted @ 2020-02-01 11:19 三道_python 阅读(1368) 评论(0) 推荐(0)
python 计算器
摘要:弄了6个小时,各种出错,伪静态规则出错1次, def逻辑思维出错1次。哈哈 # 实现加减乘除及拓号优先级解析 # 用户输入 1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) 阅读全文
posted @ 2020-01-30 16:06 三道_python 阅读(224) 评论(0) 推荐(0)
python re 正则表达式-基础版
摘要:import re #正则表达式是用来干什么的?匹配字符串 #首先回顾一下字符串的使用方法。 # s = "hello world" # print(s.find("e")) #查找 # ret = s.replace("ll","xx") # print(ret) # print(s.split( 阅读全文
posted @ 2020-01-29 20:08 三道_python 阅读(234) 评论(0) 推荐(0)
#课程回忆day 17 生成器,迭代器,yield send iter next
摘要:#课程回忆day 17 生成器,迭代器,yield send iter next#列表生成式print([x*2+6 for x in range(10)])#生成器(generator Object)# next send 方法#创建生成器两种方式:# 1.(x*2+6 for x in rang 阅读全文
posted @ 2020-01-28 16:10 三道_python 阅读(190) 评论(0) 推荐(0)
random 模块 python 生成大写字母,小写字母及数字的5位随机数
摘要:import random print(random.random()) #0.1-1 print(random.randint(1,8)) #1-8 print(random.choice("helloworld")) #h e l l o w o r l d 打散字符串,随机输出一个。 prin 阅读全文
posted @ 2020-01-28 15:36 三道_python 阅读(3404) 评论(0) 推荐(0)
time模块
摘要:import time # print(time.time()) # time.sleep(3) # print(help(time)) # print(time.gmtime()) # 中国24个时区 北京+8 结构化时间time.struct_time(tm_year=2020, tm_mon= 阅读全文
posted @ 2020-01-28 15:34 三道_python 阅读(173) 评论(0) 推荐(0)
python day16 之装饰器-不修改源代码增加功能
摘要:import time def foo(): print("foo....") time.sleep(1) def bar(): print("bar>>>") time.sleep(2) def timea(x): starttime = time.time() x() overtime = ti 阅读全文
posted @ 2020-01-23 17:38 三道_python 阅读(296) 评论(0) 推荐(0)
作业,三级城市系统对文件进行增删改操作。
摘要:f = open("city.txt","r",encoding="utf-8") china_city = eval(f.read()) f.close() print("操作说明:增加》z,删除》del,进入》直接输入名称,返回上层》b") def quits(): import os prin 阅读全文
posted @ 2020-01-13 22:43 三道_python 阅读(167) 评论(0) 推荐(0)
购物车小程序的实现 python 进阶第五课
摘要:product_list = ["1.iphone6s 5800元","2.mac book 9000元","3.coffee 32元","4.python 80元","5.bicyle 1500元"] product_cart = [] def sales(code,price): if sala 阅读全文
posted @ 2020-01-06 08:05 三道_python 阅读(192) 评论(0) 推荐(0)
Python 初学者 之 while 九九乘法表。
摘要:话不多说,直接看代码 number1 = 9 while number1>0: print (str(number1) + "*"+ str(number1) + "=" + str(number1**2)) number1 -=1 他们说不换行的话,在句尾加逗号,但是加了还是换行啊,求解。。 nu 阅读全文
posted @ 2019-12-29 17:50 三道_python 阅读(474) 评论(0) 推荐(0)
python初体验
摘要:金角大王 的课程确实不错。 从第一节课作业写起。直接看吧。 1 import sys 2 user_name = "alx" 3 password = 123456 4 import time 5 6 import os 7 if os.access("lock.txt", os.F_OK): 8 阅读全文
posted @ 2019-12-28 21:04 三道_python 阅读(253) 评论(0) 推荐(0)