当前位置: 首页>>代码示例>>Python>>正文


Python Report.set_timespan方法代码示例

本文整理汇总了Python中report.Report.set_timespan方法的典型用法代码示例。如果您正苦于以下问题:Python Report.set_timespan方法的具体用法?Python Report.set_timespan怎么用?Python Report.set_timespan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在report.Report的用法示例。


在下文中一共展示了Report.set_timespan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: range

# 需要导入模块: from report import Report [as 别名]
# 或者: from report.Report import set_timespan [as 别名]
    #parser.add_option("-c", "--crime", dest="crime", default=None)
    parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False)
    (options, args) = parser.parse_args()

    for item in report_items:
        if options.verbose == True:
            print item['name']
        item['date_type'] = options.date_type
        item['location'] = options.location
        item['report_type'] = options.report_type
        year = date.today().year
        month = date.today().month
        ym = '%d%d' % (year, month)
        if month < 10:
            ym = '%d0%d' % (year, month)

        for ago in range(24):
            item['numago'] = ago 
            report = Report(*args, **item)
            report.set_timespan('', ago)
            # Rankings output comes default in specific report,
            # so if we're specifying rankings as the report_type that means
            # we're using this output for something else... something else that
            # needs it in ready-to-write-the-compiled-json-to-a-file format.
            if item['report_type'] == 'rankings':
                print '"%s__%d": ' % ( item['slug'], int(ym) ) 
                print '%s,' % json.dumps(report.get_crime_item()),
            else:
                print report.get_crime_item()
            ym = yearmonth_subtract(ym)
开发者ID:freejoe76,项目名称:crime,代码行数:32,代码来源:monthly.py


注:本文中的report.Report.set_timespan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。