上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页
  2017年9月7日
摘要: 使用pillow或者pil库编写 阅读全文
posted @ 2017-09-07 21:52 神秘藏宝室 阅读(241) 评论(0) 推荐(0) 编辑
  2017年9月5日
摘要: ``` import os,re 代码所在位置 FILE_PATH = './' def analyze_code(codefilesource): ''' 打开一个py文件统计其中的代码行数,包括空格和注释 返回该文件总行数,注释函数,空行输 :param codefilesource: :ret 阅读全文
posted @ 2017-09-05 22:54 神秘藏宝室 阅读(306) 评论(0) 推荐(0) 编辑
摘要: ``` bytes object b = b"example" str object s = "example" #str to bytes bytes(s, encoding = "utf8") #bytes to str str(b, encoding = "utf-8") #an alternative method ... 阅读全文
posted @ 2017-09-05 22:52 神秘藏宝室 阅读(191) 评论(0) 推荐(0) 编辑
摘要: ``` try: from PIL import Image, ImageDraw, ImageFont, ImageEnhance except ImportError: import Image, ImageDraw, ImageFont, ImageEnhance import os myPath = './srcimg/' outPath = './destimg/' ... 阅读全文
posted @ 2017-09-05 21:00 神秘藏宝室 阅读(243) 评论(0) 推荐(0) 编辑
摘要: ``` #use python3.6 import re from collections import Counter FILESOURCE = './abc.txt' def getMostCommonWord(artlclefilesource): pattern = r"""[A-Za-z]+|\$?\d+%?$""" with open(artlclefilesourc... 阅读全文
posted @ 2017-09-05 17:31 神秘藏宝室 阅读(467) 评论(0) 推荐(0) 编辑
摘要: ``` import string import random #激活码中的字符和数字 field = string.ascii_letters + string.digits #获得四个字母和数字的随即组合 def getRandom(): return "".join(random.sample(field,4)) #生成的每个激活码中有几组 def concatenate(gr... 阅读全文
posted @ 2017-09-05 17:09 神秘藏宝室 阅读(284) 评论(0) 推荐(0) 编辑
摘要: ``` encoding=utf 8 ''''' pil处理图片,验证,处理 大小,格式 过滤 压缩,截图,转换 图片库最好用Pillow 还有一个测试图片img.jpg, 一个log图片,一个字体文件 ''' 图片的基本参数获取 try: from PIL import Image, ImageD 阅读全文
posted @ 2017-09-05 13:58 神秘藏宝室 阅读(837) 评论(0) 推荐(0) 编辑
摘要: 在python2下用pil,而在python3下可以安装pillow 功能,在图片上加上几个字 阅读全文
posted @ 2017-09-05 13:31 神秘藏宝室 阅读(1003) 评论(0) 推荐(0) 编辑
  2017年9月4日
摘要: 1.新建文件夹suba和subb,文件夹下新建__init__.py,内容可以为空 2.suba内新建文件aa.py bb.py 3.subb内新建文件cc.py dd.py 4.setup.py文件内容 5.然后 阅读全文
posted @ 2017-09-04 21:57 神秘藏宝室 阅读(276) 评论(0) 推荐(0) 编辑
  2017年9月1日
摘要: 大家应该知道python中print之后是默认换行的, 那如何我们不想换行,且不想讲输出内容用一个print函数输出时,就需要改变print默认换行的属性, 方法如下: print('contents', end='!@ $%^& ') end就表示print将如何结束,默认为end="\n"(换行 阅读全文
posted @ 2017-09-01 20:56 神秘藏宝室 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页

 >>>转载请注明出处<<<