
python学习笔记
yingqubaifumei
这个作者很懒,什么都没留下…
展开
-
运行GAN代码遇到问题UserWarning: Warning: converting a masked element to nan.
问题解决参考http://www.itkeyword.com/doc/882150579506621x604/minor-ticks-on-logarithmic-axis-in-matplotlibEdit after answer:Problem solved by replacingax.set_yticks((1,10,100,1000))ax.set_yticklabels...原创 2019-10-30 14:20:46 · 4595 阅读 · 1 评论 -
python yield理解
参考:https://blog.youkuaiyun.com/mieleizhi0522/article/details/82142856转载 2019-07-11 11:01:11 · 120 阅读 · 0 评论 -
使用opencv获取视频时长
import osimport cv2import reimport logging#定义函数获取视频路径及名称def getVideoNames(path=os.path.realpath(__file__)): name = [] #存储视频绝对路径及名称 count=0 ''':param root当前目录的路径,dirs为该目录下的子目录,f...原创 2019-07-11 16:27:40 · 7030 阅读 · 2 评论 -
pycharm使用技巧
多行代码缩进:选中代码,按Tab键多行代码回退:选中代码,按shift+Tab键多行注释:选中代码,按/键原创 2019-07-11 20:48:08 · 136 阅读 · 0 评论 -
python向上取整,向下取整,四舍五入
import mathf = 5.49print math.ceil(f) #向上取整print math.floor(f) #向下取整print round(f) #四舍五入转载 2019-07-11 20:52:00 · 8654 阅读 · 0 评论 -
Ubuntu18安装pycharm
1.官网下载pycharm安装包,.tar.gz格式2.打开终端执行命令,tar -zxvf 安装包名称3.cd 到解压文件的bin文件夹下,./pycharm.sh安装4.快捷方式cd /usr/share/applicationssudo gedit pycharm.desktop[Desktop Entry]Version=1.0Type=Application...原创 2019-08-10 21:08:03 · 652 阅读 · 0 评论 -
判断python文件/目录是否存在
1、使用os模块a. 判断文件是否存在os.path.isfile(path)b. 判断目录是否存在os.path.isdir(path)c. 判断文件是否存在# 使用 path 模块os.path.exists(path)# 使用 access() 方法os.access(path, os.F_OK)2、使用open函数捕捉异常如果直接用ope...转载 2019-09-19 14:20:06 · 264 阅读 · 0 评论