Python
莫非墨妮
这个作者很懒,什么都没留下…
展开
-
如何解决:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 0: invalid start byte
使用下面python代码读取csv文件:import csvwith open('dataset\\beijing_location_monitor_points.csv','r',encoding='UTF-8') as csvfile: reader=csv.reader(csvfile) rows=[row for row in reader]出现如下报错:Unic...原创 2019-05-15 19:12:27 · 11788 阅读 · 3 评论 -
python绘制动态图
python绘制动态散点图from matplotlib import pyplot as pltimport numpy as npimport mathfig=plt.figure()ax=fig.add_subplot(1,1,1)plt.ion()for i in range(10): x=i y = math.sin(x) ax.plot(x,y,m...原创 2019-09-16 17:13:44 · 1189 阅读 · 0 评论 -
python删除指定文件目录下的所有文件
python删除指定文件目录下的所有文件import oscur_path1='./results/NN/adpate_matrix/'ls=os.listdir(cur_path1)for i in ls: c_path=os.path.join(cur_path1,i) os.remove(c_path)原创 2019-09-17 09:06:42 · 983 阅读 · 0 评论 -
python实验计时
python实验计时import timestart=time.clock()'''代码段'''end=time.clock()print("运行所需时间(s):",end-start)原创 2019-09-17 09:39:50 · 289 阅读 · 0 评论