摘要: def reverseWords(input): # 通过空格将字符串分隔符,把各个单词分隔为列表 inputWords = input.split(" ") # 翻转字符串 # 假设列表 list = [1,2,3,4], # list[0]=1, list[1]=2 ,而 -1 表示最后一个元素 阅读全文
posted @ 2019-11-04 17:50 一只竹子 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 标准数据类型 Python3 中有六个标准的数据类型: Number(数字) String(字符串) List(列表) Tuple(元组) Set(集合) Dictionary(字典) Python3 的六个标准数据类型中: 不可变数据(3 个):Number(数字)、String(字符串)、Tup 阅读全文
posted @ 2019-11-04 17:25 一只竹子 阅读(142) 评论(0) 推荐(0) 编辑
摘要: import 与 from...import 在 python 用 import 或者 from...import 来导入相应的模块。 将整个模块(somemodule)导入,格式为: import somemodule 从某个模块中导入某个函数,格式为: from somemodule impor 阅读全文
posted @ 2019-11-04 17:07 一只竹子 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 多行语句 Python 通常是一行写完一条语句,但如果语句很长,我们可以使用反斜杠(\)来实现多行语句,例如: 在 [], {}, 或 () 中的多行语句,不需要使用反斜杠(\),例如: 阅读全文
posted @ 2019-11-04 16:54 一只竹子 阅读(3254) 评论(0) 推荐(0) 编辑
摘要: import yagmailsmtp = yagmail.SMTP(host='smtp.qq.com',user='157862589@qq.com', password='nzyzcimutivobhgc')#密码根据不同的邮箱填写,有授权码的邮箱,password填写授权码smtp.send( 阅读全文
posted @ 2019-11-03 22:05 一只竹子 阅读(266) 评论(0) 推荐(0) 编辑
摘要: import nnloglog = nnlog.Logger('test.log',level='debug',backCount=5,when='s')log.debug('debug级别')# debug# info# warning# error 阅读全文
posted @ 2019-11-03 22:04 一只竹子 阅读(128) 评论(0) 推荐(0) 编辑
摘要: import jsonpath# d = {#d = { "error_code": 0, "stu_info":[ { "id": 314, "name": "矿泉水", "sex": "男", "age": 18, "addr": "北京市昌平区", "grade": "摩羯座", "phone 阅读全文
posted @ 2019-11-03 22:03 一只竹子 阅读(1519) 评论(0) 推荐(0) 编辑
摘要: import time import redisr = redis.Redis(host='1.1.1.1',password='H*',port=6379,db=0,decode_responses=True) #r2 = redis.Redis(host='1.1.1.1',password=' 阅读全文
posted @ 2019-10-31 23:44 一只竹子 阅读(123) 评论(0) 推荐(0) 编辑
摘要: import hashlib# import md5 python2# s='1'## # m = hashlib.md5( s )# m = hashlib.sha224( s.encode() )# result = m.hexdigest() #获取加密后的结果# print(result)# 阅读全文
posted @ 2019-10-31 23:42 一只竹子 阅读(96) 评论(0) 推荐(0) 编辑
摘要: import xlrd book = xlrd.open_workbook(r'/Users/nhy/Desktop/中奖名单.xlsx')sheet = book.sheet_by_index(0)# sheet = book.sheet_by_name('sheet1')result = she 阅读全文
posted @ 2019-10-31 23:41 一只竹子 阅读(251) 评论(0) 推荐(0) 编辑