
Python
zffustb
这个作者很懒,什么都没留下…
展开
-
停止Jupyter Lab的方法
jupyter lab stop [port]原创 2023-03-07 15:26:26 · 2413 阅读 · 0 评论 -
可视化一个批次的PyTorch张量类型的图片的一种方法
可视化一个批次的pytorch张量类型的图片原创 2022-06-23 15:22:14 · 755 阅读 · 0 评论 -
python-docx替换Word中图片的方法
使用以下的代码:import docxfrom docx.shared import Cmdef replace_img(in_word_path, out_word_path, output_paragraph_idx, new_img_path, height, width): """ Replace a image in a docx(Word) file. :param in_word_path: The path of the input docx file to原创 2022-05-05 21:11:12 · 4411 阅读 · 1 评论 -
Python获取对象的类名的方法
使用下面代码:type(instance).__name__原创 2021-10-30 23:00:30 · 1987 阅读 · 0 评论 -
tensorflow输出的人脸图片经过OpenCV write的图片是蓝色的问题的解决方案
如果有问题,欢迎指正。很大可能是RGB调整错误,应该使用下面的代码调整相应的RGB通道:cv2.imwrite([your_output_img_path], your_image[:, :, ::-1])原创 2021-07-08 19:15:58 · 712 阅读 · 0 评论 -
Python对lambda表达式在冒号后面加上逗号的语句的解析
在Python中,会出现如下的代码写法:z = lambda a, b: True, 5对于这种情况,Python不会把a赋值为True并且把b赋值为5,而会认为z是一个元组,元组中的第0个元素是z = lambda a, b: True,第1个元素是5。原创 2021-07-06 22:33:45 · 637 阅读 · 0 评论 -
pycharm连接docker中的python解释器的方法
本文在PyCharm版本为PyCharm 2020.2.3环境下配置成功,如果有问题,欢迎交流讨论。使用下面这篇博客中的方法给自己的docker镜像配置ssh访问:docker安装Ubuntu以及ssh连接 - MengW9 - 博客园 (cnblogs.com)之后,在pycharm中依次点击File->Settings->Project:[your_project_name]->Python interpreter->小齿轮->Add->SSH .原创 2021-06-06 22:05:14 · 1334 阅读 · 0 评论 -
Python获取当前python文件所在的目录的一种方法
from pathlib import Pathpath_of_dir_of_this_python_file=Path(__file__).resolve().parent原创 2020-12-19 11:26:09 · 706 阅读 · 1 评论