摘要: #读EXCEL需要导入xlrd模块 在python控制台pip install xlrd模块import xlrdbook = xlrd.open_workbook('stu3.xls')sheet = book.sheet_by_index(0)# sheet = book.sheet_by_na 阅读全文
posted @ 2019-01-16 17:05 yulinlin_coding 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 导入hashlib模块import hashlibs='yulin123456's.encode()#把数字转换成bytes类型m=hashlib.md5(s.encode())print(m.hexdigest())#md5是不可逆的,就是没有办法解密的,网站MD5加密属于撞库,将常用的密码搜集存 阅读全文
posted @ 2019-01-16 15:57 yulinlin_coding 阅读(332) 评论(0) 推荐(0) 编辑
摘要: #操作数据库连接import pymysqlconn = pymysql.connect(host='118.24.3.40',user='jxz', password='123456',port=3306, db='jxz',charset='utf8',autocommit=True)cur = 阅读全文
posted @ 2018-12-15 17:35 yulinlin_coding 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 内置函数学习# sorted# map# filter# max# sum# round# chr# ord# dir# bool# eval# exec# zipimport mathres = max([1,2,3,4])res = sum(range(1,101))# print(chr(66 阅读全文
posted @ 2018-12-15 17:34 yulinlin_coding 阅读(504) 评论(0) 推荐(0) 编辑
摘要: 一,time模块学习 import time 阅读全文
posted @ 2018-12-15 17:30 yulinlin_coding 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 一.什么是函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段。 函数能提高应用的模块性,和代码的重复利用率。你已经知道Python提供了许多内建函数,比如print()。但你也可以自己创建函数,这被叫做用户自定义函数。 定义一个函数 你可以定义一个由自己想要功能的函数,以下是简单 阅读全文
posted @ 2018-11-28 10:37 yulinlin_coding 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 一,什么是元祖 Python的元组与列表类似,不同之处在于元组的元素不能修改。 元组使用小括号,列表使用方括号。 元组创建很简单,只需要在括号中添加元素,并使用逗号隔开即可。 1.创建一个空元组 tup=() 2.元组中只包含一个元素时,需要在元素后面添加逗号 tup1=(yu,) 3.元组与字符串 阅读全文
posted @ 2018-11-28 10:22 yulinlin_coding 阅读(270) 评论(0) 推荐(0) 编辑
摘要: #读文件,文件必须存在才能读f=open('操作文件',encoding='utf-8')res =f.read()print(res)f.close()#写文件fw=open('操作文件',mode='a',encoding='utf-8')#使用a会保留原来的数据,w的话会覆盖掉前面的数据fw. 阅读全文
posted @ 2018-11-22 22:28 yulinlin_coding 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 字符串常用函数 # s='.abcd.'# new_s=s.strip('.')#默认去掉字符串两边的空格和换行符,想去掉什么括号中就写什么# print('s',s)# print('new_s',new_s)# t='.hhjDDDhjhj.'# print(t.rstrip('.'))# pr 阅读全文
posted @ 2018-11-22 22:26 yulinlin_coding 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 列表list-数组stus=['苹果','香蕉','橘子','红枣',111.122,]# 下标 0 1 2 3 4#下标,索引,角标#print(stus[4]) #st=[]#空list#st=list()#空list#增加元素stus.append('榴莲')#在list末尾增加一个元素stu 阅读全文
posted @ 2018-11-22 22:18 yulinlin_coding 阅读(133) 评论(0) 推荐(0) 编辑