![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python学习笔记
阳光小美女
这个作者很懒,什么都没留下…
展开
-
Python3 强制类型转换问题
刚开始学python,按照菜鸟教程写了个小例子,代码如下:当输入为整数时,程序无错误。心血来潮输入3.3,run后报错如下:原因如下: 忽略了input()默认接收到的是字符串类型,即:原语句变为b = int('3.3'),这在python中是非法的。...原创 2018-07-03 22:20:35 · 14552 阅读 · 2 评论 -
numpy整理----mat()
numpy 用于矩阵运算from numpy import *;#导入numpy的库函数import numpy as np; #这个方式使用numpy的函数时,需要以np.开头。1.mat---创建矩阵举例及用法:https://blog.csdn.net/qq_30638831/article/details/79907684data1=mat(zeros((3,3)));...原创 2018-09-13 16:17:28 · 4926 阅读 · 0 评论 -
错误集锦
一、TypeError1、TypeError: only size-1 arrays can be converted to Python scalars math.log()不能对矩阵进行直接操作,只处理数值。当math与numpy同时存在时,默认调用的log()为math.log()。改:1)调用numpy.log() 2)遍历,处理数...原创 2018-09-14 11:38:25 · 153 阅读 · 0 评论