共 11 篇文章
显示摘要每页显示  条
>>> time.localtime()time.struct_time(tm_year=2016, tm_mon=6, tm_mday=8, tm_hour=15, tm_min=35, tm_sec=33, tm_wday=2, tm_yday=160, tm_isdst=0)>>> time.localtime(time.time() - 86400)time.struct_time(tm_year=2016, tm_mon=6, tm_mday=7, tm_hour=15, tm_min=37, tm_sec=10, tm_wday=1, tm_yday=159, tm_isdst=0)...
In [32]: from datetime import datetimeIn [33]: #获取当前时间In [34]: datetime.now()Out[34]: datetime.datetime(2016, 7, 21, 23, 12, 51, 572284)In [35]: datetime.today()Out[35]: datetime.datetime(2016, 7, 21, 23, 13, 1, 458328)In [36]: #获取零时区时间In [37]: datetime.utcnow()Out[37]: datetime.datetime(2016, 7, 21, 15, ...
用 python 来操作 docx, xlsx 格式文件(一)(使用 xlsxwriter 库操作xlsx格式文件)二、xlsxwriter 格式处理,将待添加数据转换成相应的格式,添加到 xlsx 文件中。format = workbook.add_format()#用对象接口设置格式属性format.set_bold()format.set_font_color(''''''''red'''''...
用 python 来操作 docx, xlsx 格式文件(二)(使用 docx 库操作 docx 格式文件。from docx.enum.style import WD_STYLE_TYPEfrom docx import *document = Document()styles = document.styles#生成所有段落样式for s in styles: if s.type == WD_STYLE_TYPE.PARAGRAPH: document.add_paragraph(''''''''Par...
Python定时执行之Timer./usr/bin/env python from threading import Timer import time timer_interval=1 def delayrun(): print ''''''''running'''''''' t=Timer(timer_interval,delayrun) t.start() while True: time.sleep(0.1) print ...
# -*- coding: utf-8 -*-from time import timedef method1(): t = time() for i in xrange(100000): s = ''''''''pythontab''''''''+''''''''pythontab''''''''+'''''&#...
numpy : percentile使用(多用于去除 离群点)Examples -------- >>>a = range(1,101) >>>np.percentile(a, 90) #90%的分位数 90.1 #表示有百分之九十的数小于90.1。>>>np.percentile(a, 50, axis=0) #axis为0,在纵列上求 array([[ 6.5, 4.5, 2.5]]) >>>np.percentile(a, 50, axis=1) #axis为1,在横行上...
1 # -*- coding: utf-8 -*- 2 3 import matplotlib.pyplot as plt #引入matplotlib的pyplot子库,用于画简单的2D图 4 import random 5 6 x= range(0,20) 7 y= [random.randint(0,20) for _ in range(20)] 8 9 #建立对象10 fig = plt.figure(figsize=(8,6))11 ax = fig.add_subplot() 12 13 #画图14 plt.plot(x,y,'''''&...
# Let''''''''s load the csv filef = open(''''''''crime_rates.csv'''''''', ''''''''r'''''''')data = f.read()rows = data.split('''''''...
举例详解Python中的split()函数的使用方法 举例详解Python中的split()函数的使用方法。Python中有split()和os.path.split()两个函数,具体作用如下:split():拆分字符串。>>> str="hello boy<[www.doiido.com]>byebye" >>> print str.split("[")[1].split("]")[0]www.doiido.com >...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部