随笔分类 -  python

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 48 下一页
摘要:输出 阅读全文
posted @ 2019-04-28 12:18 anobscureretreat 阅读(3148) 评论(0) 推荐(0)
摘要:输出 例子 输出 阅读全文
posted @ 2019-04-25 00:03 anobscureretreat 阅读(1747) 评论(0) 推荐(0)
摘要:双精度浮点数格式,即IEEE 754标准 阅读全文
posted @ 2019-04-20 15:11 anobscureretreat 阅读(610) 评论(0) 推荐(0)
摘要:test.py 输出: 参考: https://blog.csdn.net/qq_31331027/article/details/80518348 阅读全文
posted @ 2019-04-20 01:55 anobscureretreat 阅读(5494) 评论(0) 推荐(2)
摘要:json:是一种数据格式,是纯字符串。可以被解析成Python的dict或者其他形式。 dict:是一个完整的数据结构,是对Hash Table这一数据结构的一种实现,是一套从存储到提取都封装好了的方案。它使用内置的哈希函数来规划key对应value的存储位置,从而获得O(1)的数据读取速度。 字典 阅读全文
posted @ 2019-04-19 16:26 anobscureretreat 阅读(264) 评论(0) 推荐(0)
摘要:输出: demo2 输出 阅读全文
posted @ 2019-04-19 12:56 anobscureretreat 阅读(19911) 评论(0) 推荐(1)
摘要:python2 #coding=utf-8 class CustomError(Exception): def __init__(self,ErrorInfo): self.errorinfo=ErrorInfo def __str__(self): return self.errorinfo if __name__ == '__main__... 阅读全文
posted @ 2019-04-19 00:05 anobscureretreat 阅读(181) 评论(0) 推荐(0)
摘要:证书不匹配问题 1.对于python自带的 urllib库 解决办法 2. 对于requests 库,解决办法 阅读全文
posted @ 2019-04-16 16:15 anobscureretreat 阅读(786) 评论(0) 推荐(0)
摘要:参考: https://blog.csdn.net/beking17113/article/details/83213071 阅读全文
posted @ 2019-04-15 18:24 anobscureretreat 阅读(3560) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import serial #打开串口 serialPort="COM3" #串口 baudRate=9600 #波特率 ser=serial.Serial(serialPort,baudRate,timeout=0.5) print("参数设置:串口={{}} ,波特率={{}}".format(serialPort,baudRate)) ... 阅读全文
posted @ 2019-04-15 18:05 anobscureretreat 阅读(4321) 评论(0) 推荐(0)
摘要:def input_password(): # 1. 提示用户输入密码 pwd = input("请输入密码:") # 2. 判断密码长度,如果长度 >= 8,返回用户输入的密码 if len(pwd) >= 8: return pwd # 3. 密码长度不够,需要抛出异常 # 1> 创建异常对象 - 使用异常的错误信息字符串... 阅读全文
posted @ 2019-04-15 11:11 anobscureretreat 阅读(228) 评论(0) 推荐(0)
摘要:class CustomError(Exception): def __init__(self,ErrorInfo): super().__init__(self) #初始化父类 self.errorinfo=ErrorInfo def __str__(self): return self.errorinfo if _... 阅读全文
posted @ 2019-04-15 10:56 anobscureretreat 阅读(355) 评论(0) 推荐(0)
摘要:test.py 阅读全文
posted @ 2019-04-10 19:34 anobscureretreat 阅读(6711) 评论(0) 推荐(0)
摘要:#当前文件的路径 pwd = os.getcwd() #当前文件的父路径 father_path=os.path.abspath(os.path.dirname(pwd)+os.path.sep+".") #当前文件的前两级目录 grader_father=os.path.abspath(os.path.dirname(pwd)+os.path.sep+"..") 阅读全文
posted @ 2019-04-10 19:24 anobscureretreat 阅读(572) 评论(0) 推荐(0)
摘要:import os import tarfile def make_targz_one_by_one(output_filename, source_dir): tar = tarfile.open(output_filename,"w:gz") for root,dir,files in os.walk(source_dir): for file in f... 阅读全文
posted @ 2019-04-10 17:32 anobscureretreat 阅读(492) 评论(0) 推荐(0)
摘要:参考:http://docs.python-requests.org/en/master/user/quickstart/#make-a-request 阅读全文
posted @ 2019-04-10 17:03 anobscureretreat 阅读(500) 评论(0) 推荐(0)
摘要:输出 阅读全文
posted @ 2019-03-29 10:05 anobscureretreat 阅读(1533) 评论(0) 推荐(0)
摘要:2s启动一个定时器: 阅读全文
posted @ 2019-03-28 19:33 anobscureretreat 阅读(388) 评论(0) 推荐(0)
摘要:def oper(a,*args): print(args) print(a) oper("q","s","d","z","b","f") 阅读全文
posted @ 2019-03-28 19:27 anobscureretreat 阅读(998) 评论(0) 推荐(0)
摘要:当使用requests的get下载大文件/数据时,建议使用使用stream模式。 当把get函数的stream参数设置成False时,它会立即开始下载文件并放到内存中,如果文件过大,有可能导致内存不足。 当把get函数的stream参数设置成True时,它不会立即开始下载,当你使用iter_cont 阅读全文
posted @ 2019-03-28 16:34 anobscureretreat 阅读(379) 评论(0) 推荐(0)

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 48 下一页