
python
hello_world_banni
这个作者很懒,什么都没留下…
展开
-
Pycharm相关
1. Pycharm添加PYTHONPATH2. Pycharm带参数编译运行原创 2021-06-03 00:49:44 · 95 阅读 · 0 评论 -
pytorch中的函数摘录
Categorical.log_prob()log_prob takes the log of the probability (of some actions). Example:action_logits = torch.rand(5)action_probs = F.softmax(action_logits, dim=-1)action_probsReturns:tensor([0.1457, 0.2831, 0.1569, 0.2221, 0.1922])Then:dist =原创 2021-05-01 23:43:14 · 956 阅读 · 0 评论 -
argparse官网文档翻译及整理
This tutorial is intended to be a gentle introduction to argparse, the recommended command-line parsing module in the Python standard library.这篇教程旨在作为 argparse 的入门介绍,此模块是 Python 标准库中推荐的命令行解析模块。–helpimport argparseparser = argparse.ArgumentParser()pars原创 2021-03-28 14:19:02 · 289 阅读 · 0 评论 -
Python Package
1、Sympy用于符号数学的Python库。tutorial原创 2020-10-21 20:25:27 · 113 阅读 · 0 评论 -
C++/JAVA/Python语法层面的差别
因为做题时,经常会混用几种语言的语法,导致难以察觉的错误,特记录如下:1 三目运算符C++int main() { int x = 100; int y = x > 0 ? x : -x; int z = x ? x > 0 : -x; cout << "y : " << y << ",z : " << z << endl;}输出:y : 100, z : 1JAVApublic cla原创 2020-10-18 22:20:46 · 139 阅读 · 0 评论 -
ubuntu16安装Python3.7
ubuntu16系统自带了python2.7和python3.5;不要卸载ubuntu自带的python版本;ubuntu下不同版本的python可以共存,可直接安装python3.7。1.升级包索引和软件sudo apt updatesudo apt upgrade -y2.安装编译所需包sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadli原创 2020-08-29 18:18:46 · 2189 阅读 · 0 评论 -
PyQt调用JavaScript代码时传递参数的类型为列表
在PyQt5对象中访问JavaScript的核心代码如下:QWebEnginePage.runJavaScript(str,Callable);可以看到,传递参数只能是字符串类型。所以我们可以采用在Pyqt端列表转字符串,在JavaScript端字符串转列表的方式。如想要传递的列表为:obj=[["hello","world"],["banni"],["hahaha","!"]]PyQt端代码为:for i in range(len(obj)): obj[i]="+".join(obj[原创 2020-05-21 10:22:57 · 710 阅读 · 0 评论 -
python package
1.conda 换源安装换成清华源。conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda conf...原创 2020-02-10 18:06:42 · 350 阅读 · 0 评论 -
Spyder Tips
Header template for new empty fileHere is how to change it:“Tools” Menu > “Preferences” entry > “Editor” page > “Advanced settings” tab > “Edit template for new modules” button...原创 2020-02-06 12:20:19 · 297 阅读 · 0 评论 -
用imageio读灰度图
import scipy.misc img_array = scipy . misc . imread ( image_file_name , flatten = True)在scipy 1.3.1版本下读取灰度图报错:AttributeError: module 'scipy.misc' has no attribute 'imread'查明原因:imreadwas de...原创 2019-12-08 22:13:28 · 4858 阅读 · 2 评论 -
python中级用法学习指引
1、迭代器与生成器原创 2018-03-25 10:05:58 · 366 阅读 · 0 评论