随笔分类 -  python

摘要:参考链接 https://tinypng.com/developers/reference/python 1、安装 2、使用python脚本压缩图片 3、注册获取key 4、例如: 阅读全文
posted @ 2016-03-21 11:26 lipeil 阅读(841) 评论(0) 推荐(0)
摘要:file = open('face.txt','r')filew = open('face1.txt','w') try: for line in file: print(line) if line.strip() !='': line... 阅读全文
posted @ 2015-09-29 19:59 lipeil 阅读(686) 评论(0) 推荐(0)
摘要:import osimport syspath = "D:\emojis"for (path,dirs,files) in os.walk(path): for filename in files: newname = "emoji_"+filename os.re... 阅读全文
posted @ 2014-06-04 17:04 lipeil 阅读(17886) 评论(0) 推荐(0)
摘要:## r表示读 rb表示读二进制 file_object = open('test.py','r')try: file_text=file_object.read()finally: file_object.close()print file_text## 可以直接用for循环遍历文件每行file_input= open('test.py', 'r')try: for line in file_input: print linefinally: file_input.close()## 或者使用readlines读取每行file_ 阅读全文
posted @ 2012-12-04 11:37 lipeil 阅读(171) 评论(0) 推荐(0)