随笔分类 - 每天一个小程序 Python
摘要:#文件读写模式 #命令 read() 方法用于从文件读取指定的字节数,如果未给定或为负则读取所有。 readline() 读取整行,包括 "\n" 字符。 reaadlines() 读取所有行并返回列表,若给定sizeint>0,则是设置一次读多少字节,这是为了减轻读取压力
阅读全文
摘要://测试环境 Python 2.7 安装 使用 img 是图片的地址。 code是验证码
阅读全文
摘要:#-*- coding:utf-8 -*- class Car(object): # 静态字段 通过Car.country来访问.(静态字段属于类)(普通字段属于对象) country = '中国' def __init__(self,make,model,year): # 普通字段 obj.name self.make = ma...
阅读全文
摘要:新式类,具有三种@property装饰器 经典类
阅读全文
摘要:### ### ### 参考博客: http://blog.csdn.net/zyz511919766/article/details/25136485
阅读全文
摘要:### curl命令 ### urllib2另外一种用法: ### ###
阅读全文
摘要:### 备注只是好奇测试了下。 和风天气官网地址:https://www.heweather.com/ 和风天气接口注册后可以免费试用。 ###
阅读全文
摘要:### if - else 如果2小于1,则b=1,否则b=2 ### ###
阅读全文
摘要:### 现在我有一个简单的myfunc函数,现在我想对myfunc函数增加功能。下面我们增加一个deco的功能。 但是这种方式存在一个问题,修改了myfunc的原来的调用方式:myfunc() > 变成了 deco(myfunc)。所以我们做了下面的改变。 ### myfunc is myfuncm
阅读全文
摘要:### 版本1和版本2的区别就是一个会按照图片原来的顺序,一个直接给所有的文件重新命名。 ### 版本1 说明:修改os.listdir(path)下面的文件名,并且按 Newdir=os.path.join(path,'img'+numtag +filetype) 这个命名方式给文件重新命名。 版
阅读全文
摘要:import socket,hashlib client = socket.socket() client.connect(("localhost", 6971)) ##开始连接 (ServerIP,ServerPort) while True: cmd = input("Please input the message>>").strip() print(cmd) ...
阅读全文