
Python
sh15285118586
对游戏感兴趣,想做科技馆交互设计
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python 线程池下载数据
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor import os,time,random,subprocess def task(cmd): print('%s is runing' %os.getpid()) sub = subprocess.Popen(cmd, shell = True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) .原创 2021-03-15 10:16:41 · 317 阅读 · 0 评论 -
python unicode 转汉子
s1 = {"zh-CN": "\u4e2d\u56fd"} s1 = s1["zh-CN"].encode("utf-8").decode("utf-8") print(s1) str1 = '\\u5927\\u77f3\\u8857\\u9053\\u690d\\u6751\\u4e09\\u8def\\u56db\\u5df79\\u53f7' print(str1.encode('utf-8').decode('unicode_escape'))原创 2021-02-02 11:30:21 · 458 阅读 · 0 评论 -
向量旋转
本文转自:https://stackoverflow.com/questions/14066933/direct-way-of-computing-clockwise-angle-between-2-vectors dot = x1*x2 + y1*y2 # dot product between [x1, y1] and [x2, y2] det = x1*y2 - y1*x2 # determinant angle = atan2(det, dot) # atan2(y,.转载 2020-08-16 20:23:05 · 232 阅读 · 0 评论 -
python 快速下载
pip install tornado -i http://pypi.douban.com/simple --trusted-host pypi.douban.com原创 2019-10-11 10:36:39 · 3241 阅读 · 0 评论 -
python matrix to rotation
# # -----------------------Rotation----------------------------------------- # import warnings # import numpy as np # import re # _AXIS_TO_IND = {'x': 0, 'y': 1, 'z': 2} # def _elementary_basis_vect...原创 2019-09-18 11:27:23 · 1247 阅读 · 0 评论 -
python exe 添加图标
官方文档: https://pythonhosted.org/PyInstaller/usage.html 可以写成bat文件,双击一下,就自动转换了。 pyinstaller --onefile --icon=KIcon.ico --clean --paths=E:\5_PythonProjects\MMM\MMM_material E:\5_PythonProjects\MMM\MMM...原创 2019-08-29 14:42:28 · 2676 阅读 · 0 评论 -
git 使用记录
尴尬,还要简单学一下git。 查看分支: git branch -a //查看本地和远端分支 git branch -r //查看远端分支 分支切换: git checkout master git checkout branchName 创建分支: git branch branchName 删除local分支: git branch -D branchName 删除remote...原创 2019-08-21 16:22:43 · 145 阅读 · 0 评论 -
pip SSLError
pip install 失败 1、关掉翻墙。 2、系统时间要正确!!! 我经常改系统时间(理由:穷),所以关了翻墙还是不行,把系统时间改好,就OK。原创 2019-05-17 15:29:25 · 433 阅读 · 1 评论 -
python to exe
这个哥们写到不错:https://blog.youkuaiyun.com/woshisangsang/article/details/73230433 我在使用PyInstaller时,调用第三方py文件,打包提升Miss module。在import时,把文件夹目录全加入即可。 如:from a.b.c.method import start a 文件夹和py入口在同一级别。 ...原创 2019-04-20 01:25:42 · 465 阅读 · 0 评论 -
一种位图转normal贴图的方法
gray_image = cv2.cvtColor(color,cv2.COLOR_RGB2GRAY) gray_image = gray_image/255.0 rows,cols = gray_image.shape M1 = np.float32([ [1,0, 1], [0,1, 0] ]) M2 = np.float32([ [1,0,-1], [0,1, 0] ]) M3 = np...原创 2019-04-23 19:28:40 · 1531 阅读 · 0 评论 -
Python 判断变量类型
方法如下: # Variables of different types i = 1 f = 0.1 s = "Hell" l = [0, 1, 2] d = {0:"Zero", 1:"One"} t = (0, 1, 2) b = True n = None All of the following return True: isinstance(i, int) isinstance...原创 2019-03-06 15:31:09 · 1968 阅读 · 0 评论 -
Python 实现VRay Bitmap的旋转和重复偏移
功能实现了,就是比较笨重,以后有时间再优化。 import cv2 import math import numpy as np dir = "D:\\2.jpg" scale = [1.5,10.0,0.785398] def dealUVA(texPath,scale): img = cv2.imread(texPath) result = np.zeros(img.s...原创 2019-02-21 14:57:46 · 445 阅读 · 0 评论 -
Python 转 exe
网上有很多资料,我这边试着安装,都不行。最后发现是我翻墙开着,导致安装失败。 另外如果Python中调用第三方exe文件,在打包时,不会打包到exe里面,此时要把exe拷贝到Python中调用该exe文件的路径下,这样就可以了。...原创 2019-01-29 11:22:10 · 207 阅读 · 0 评论 -
python 图像移动与缩放
from PIL import Image from os import listdir import math import numpy as np import cv2 # texture: a texture # offsetX: min U ,not offset distance(=abs(min U)) # offsetY: min V ,not offset distance(=...原创 2018-11-14 12:01:54 · 2467 阅读 · 2 评论 -
python 图片正方形化
代码如下: from PIL import Image from os import listdir import math import numpy as np import cv2 def textureSquare( imgPath): img = Image.open(imgPath) width, height = img.size delta = widt...原创 2018-11-13 18:02:55 · 2157 阅读 · 0 评论 -
Python 目录的建立
Python中的包 包是一个分层次的文件目录结构,它定义了一个由模块及子包,和子包下的子包等组成的 Python 的应用环境。 简单来说,包就是文件夹,但该文件夹下必须存在 __init__.py 文件, 该文件的内容可以为空。__init__.py 用于标识当前文件夹是一个包。 考虑一个在 package_runoob 目录下的 runoob1.py、runoob2.py、__init__...原创 2018-11-09 14:46:49 · 367 阅读 · 1 评论 -
Python中re的match、search、findall、finditer区别
本文转自:https://www.cnblogs.com/nyist-xsk/p/7978488.html 这四个方法是从某个字符串中寻找特定子串或判断某个字符串是否符合某个模式的常用方法。 1、match re.match(pattern, string[, flags]) 从首字母开始开始匹配,string如果包含pattern子串,则匹配成功,返回Match对象,...转载 2018-07-17 00:26:45 · 402 阅读 · 0 评论