摘要: datetime模块用于是date和time模块的合集,datetime有两个常量,MAXYEAR和MINYEAR,分别是9999和1. datetime模块定义了5个类,分别是 1.datetime.date:表示日期的类 2.datetime.datetime:表示日期时间的类 3.dateti 阅读全文
posted @ 2018-04-12 18:19 champernain 阅读(91) 评论(0) 推荐(0)
摘要: 一:经常使用的时间方法 1.得到当前时间 3.计算昨天的日期(发散思维,计算其他日期相加、相减等): ##二:time和datetime模块常用方法简介 表示时间的两种方式: time 模块常用方法小记 1.time.clock() 2.time.sleep(secs) 3.time.localti 阅读全文
posted @ 2018-04-12 18:19 champernain 阅读(178) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2018-04-12 18:17 champernain 阅读(1) 评论(0) 推荐(0)
摘要: 本文参考自: https://stackoverflow.com/questions/18393701/the-difference-between-str-and-repr?noredirect=1&lq=1 在stackoverflow上,有个兄弟问了这个问题: 首先定义一个类: 返回的是: 更 阅读全文
posted @ 2018-04-12 18:12 champernain 阅读(196) 评论(0) 推荐(0)
摘要: 在python中,命令行解析的很好用, 首先导入命令行解析模块 import argparseimport sys 然后创建对象 parse=argparse.ArgumentParser() 然后增加命令行 parse.add_argument("--learning_rate",type=flo 阅读全文
posted @ 2018-04-12 18:12 champernain 阅读(2448) 评论(0) 推荐(0)
摘要: python 中 urlparse 模块介绍 urlparse模块主要是用于解析url中的参数 对url按照一定格式进行 拆分或拼接 1.urlparse.urlparse 将url分为6个部分,返回一个包含6个字符串项目的元组:协议、位置、路径、参数、查询、片段。 1 2 3 import url 阅读全文
posted @ 2018-04-12 18:10 champernain 阅读(808) 评论(0) 推荐(0)
摘要: 自定义matplotlib Created Saturday 08 December 2012 5.1 matplotlibrc文件 matplotlib使用matplotlibrc [matplotlib resource configurations]配置文件来自定义各种属性,我们称之为rc配置 阅读全文
posted @ 2018-04-12 18:08 champernain 阅读(504) 评论(0) 推荐(0)
摘要: Help on function rc in module matplotlib: rc(group, **kwargs) Set the current rc params. Group is the grouping for the rc, e.g., for ``lines.linewidth 阅读全文
posted @ 2018-04-12 16:59 champernain 阅读(213) 评论(0) 推荐(0)
摘要: Help on module pyclbr: NAME pyclbr - Parse a Python module and describe its classes and methods. FILE d:\programdata\anaconda2\lib\pyclbr.py DESCRIPTI 阅读全文
posted @ 2018-04-12 16:55 champernain 阅读(127) 评论(0) 推荐(0)
摘要: Help on class timedelta in module datetime: class timedelta(__builtin__.object) | Difference between two datetime values. | | Methods defined here: | 阅读全文
posted @ 2018-04-12 16:35 champernain 阅读(121) 评论(0) 推荐(0)
摘要: Help on function meshgrid in module numpy.lib.function_base: meshgrid(*xi, **kwargs) Return coordinate matrices from coordinate vectors. Make N-D coor 阅读全文
posted @ 2018-04-12 15:35 champernain 阅读(184) 评论(0) 推荐(0)
摘要: Help on module matplotlib.cm in matplotlib: NAME matplotlib.cm FILE d:\programdata\anaconda2\lib\site-packages\matplotlib\cm.py DESCRIPTION This modul 阅读全文
posted @ 2018-04-12 15:33 champernain 阅读(1367) 评论(0) 推荐(0)
摘要: Help on built-in module datetime: NAME datetime - Fast implementation of the datetime type. FILE (built-in) CLASSES __builtin__.object date datetime t 阅读全文
posted @ 2018-04-12 15:26 champernain 阅读(278) 评论(0) 推荐(0)
摘要: """ dir([object]) -> list of strings If called without an argument, return the names in the current scope. Else, return an alphabetized list of names 阅读全文
posted @ 2018-04-12 14:19 champernain 阅读(154) 评论(0) 推荐(0)
摘要: """ Return object with labels on given axis omitted where alternately any or all of the data are missing Parameters axis : {0 or 'index', 1 or 'column 阅读全文
posted @ 2018-04-12 14:00 champernain 阅读(6966) 评论(1) 推荐(0)
摘要: progressbar安装: [python] view plain copy pip install progressbar [python] view plain copy [python] view plain copy 用法一 [python] view plain copy # -*- c 阅读全文
posted @ 2018-04-12 10:31 champernain 阅读(13231) 评论(0) 推荐(1)
摘要: Python下一切皆对象,每个对象都有多个属性(attribute),Python对属性有一套统一的管理方案。 __dict__与dir()的区别: ​ 并不是所有对象都拥有__dict__属性。许多内建类型就没有__dict__属性,如list,此时就需要用dir()来列出对象的所有属性。 __d 阅读全文
posted @ 2018-04-12 10:31 champernain 阅读(542) 评论(0) 推荐(1)
摘要: os.path.dirname(__file__)返回脚本的路径,但是需要注意一下几点: 1、必须是实际存在的.py文件,如果在命令行执行,则会引发异常NameError: name '__file__' is not defined 2、在运行的时候如果输入完整的执行的路径,则返回.py文件的全路 阅读全文
posted @ 2018-04-12 10:30 champernain 阅读(589) 评论(0) 推荐(0)
摘要: os.getcwd() 和 os.path.dirname(os.path.realpath(__file__)) 的区别 先给出2个目录的结构: (1)PycharmProjects/pythonLearn/dir/dir2/getRootPath.py (2)PycharmProjects/py 阅读全文
posted @ 2018-04-12 10:30 champernain 阅读(665) 评论(1) 推荐(0)
摘要: python中os.path.dirname(__file__)的使用 (1).当"print os.path.dirname(__file__)"所在脚本是以完整路径被运行的, 那么将输出该脚本所在的完整路径,比如: python c:/python27/test/test.py 那么将输出 c: 阅读全文
posted @ 2018-04-12 10:29 champernain 阅读(2121) 评论(0) 推荐(0)