上一页 1 ··· 149 150 151 152 153 154 155 156 157 ··· 178 下一页
  2019年7月24日
摘要: import time start =time.clock() sum=0 for i in range(1,101): sum=sum+i print(sum ) end = time.clock() print('Running time: %s Seconds'%(end-start)) 阅读全文
posted @ 2019-07-24 19:52 一杯明月 阅读(1195) 评论(0) 推荐(0)
摘要: .readline() 和 .readlines() 之间的差异是后者一次读取整个文件,象 .read() 一样。.readlines() 自动将文件内容分析成一个行的列表,该列表可以由 Python 的 for … in … 结构进行处理。另一方面,.readline() 每次只读取一行,通常比 阅读全文
posted @ 2019-07-24 15:39 一杯明月 阅读(1345) 评论(0) 推荐(0)
  2019年7月23日
摘要: if __name__ == '__main__'的意思是: 当.py文件被直接运行时,if __name__ == '__main__'之下的代码块将被运行; 当.py文件以模块形式被导入时,if __name__ == '__main__'之下的代码块不被运行。 阅读全文
posted @ 2019-07-23 21:43 一杯明月 阅读(223) 评论(0) 推荐(0)
摘要: 以下是使用isinstance()函数的实例: 即:第1个参数是第2个参数的实例。 判断一个对象是不是一个类的实例。 阅读全文
posted @ 2019-07-23 21:38 一杯明月 阅读(451) 评论(0) 推荐(0)
摘要: print(float("260.01478420521632365364543423")) 260.0147842052163数字转字符串: a=10 print(str(a)) 100 阅读全文
posted @ 2019-07-23 16:15 一杯明月 阅读(1390) 评论(0) 推荐(0)
  2019年7月22日
摘要: 移步:https://www.zhihu.com/search?type=content&q=最小二乘拟合 另一个参考:Linear Regression, Clearly Explained!!! - YouTube 阅读全文
posted @ 2019-07-22 22:15 一杯明月 阅读(801) 评论(0) 推荐(0)
摘要: Python类中的self到底是干啥的 Python编写类的时候,每个函数参数第一个参数都是self,一开始我不管它到底是干嘛的,只知道必须要写上。后来对Python渐渐熟悉了一点,再回头看self的概念,似乎有点弄明白了。 首先明确的是self只有在类的方法中才会有,独立的函数或方法是不必带有se 阅读全文
posted @ 2019-07-22 12:12 一杯明月 阅读(35827) 评论(0) 推荐(2)
  2019年7月17日
摘要: 运行matlab做并行时得到如下报错: failed to start a parallel pool. (For information in addition to the causing error, validate the profile 'local' in the Cluster Pr 阅读全文
posted @ 2019-07-17 18:31 一杯明月 阅读(3916) 评论(0) 推荐(0)
摘要: a=[1 2 3 4 5] a(end:-1:1)=[5 4 3 2 1] 阅读全文
posted @ 2019-07-17 16:28 一杯明月 阅读(1833) 评论(0) 推荐(0)
  2019年7月16日
摘要: 1.quiver函数 一般用于绘制二维矢量场图,函数调用方法如下: 1 quiver(x,y,u,v) 该函数展示了点(x,y)对应的的矢量(u,v)。其中,x的长度要求等于u、v的列数,y的长度要求等于u、v的行数。在绘制图像的过程中,通常用 meshgrid 来生成所需的网格采样点。 下面举几个 阅读全文
posted @ 2019-07-16 10:30 一杯明月 阅读(13764) 评论(0) 推荐(1)
上一页 1 ··· 149 150 151 152 153 154 155 156 157 ··· 178 下一页