python学习笔记
yingqubaifumei
这个作者很懒,什么都没留下…
展开
-
运行GAN代码遇到问题UserWarning: Warning: converting a masked element to nan.
问题解决参考http://www.itkeyword.com/doc/882150579506621x604/minor-ticks-on-logarithmic-axis-in-matplotlib Edit after answer:Problem solved by replacing ax.set_yticks((1,10,100,1000)) ax.set_yticklabels...原创 2019-10-30 14:20:46 · 4450 阅读 · 1 评论 -
python yield理解
参考:https://blog.csdn.net/mieleizhi0522/article/details/82142856转载 2019-07-11 11:01:11 · 92 阅读 · 0 评论 -
使用opencv获取视频时长
import os import cv2 import re import logging #定义函数获取视频路径及名称 def getVideoNames(path=os.path.realpath(__file__)): name = [] #存储视频绝对路径及名称 count=0 ''':param root当前目录的路径,dirs为该目录下的子目录,f...原创 2019-07-11 16:27:40 · 6844 阅读 · 2 评论 -
pycharm使用技巧
多行代码缩进:选中代码,按Tab键 多行代码回退:选中代码,按shift+Tab键 多行注释:选中代码,按/键原创 2019-07-11 20:48:08 · 114 阅读 · 0 评论 -
python向上取整,向下取整,四舍五入
import math f = 5.49 print math.ceil(f) #向上取整 print math.floor(f) #向下取整 print round(f) #四舍五入转载 2019-07-11 20:52:00 · 8613 阅读 · 0 评论 -
Ubuntu18安装pycharm
1.官网下载pycharm安装包,.tar.gz格式 2.打开终端执行命令,tar -zxvf 安装包名称 3.cd 到解压文件的bin文件夹下,./pycharm.sh安装 4.快捷方式 cd /usr/share/applications sudo gedit pycharm.desktop [Desktop Entry] Version=1.0 Type=Application...原创 2019-08-10 21:08:03 · 605 阅读 · 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 · 231 阅读 · 0 评论