推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
0xABCD
V2EX  ›  Python

撸了个年度进度条提示工具

  •  
  •   0xABCD · Mar 21, 2018 · 6845 views
    This topic created in 2993 days ago, the information mentioned may be changed or developed.

    人生苦短,要时刻提醒自己时间在流逝。

    安装:
    $ pip install datebar

    使用:
    $ datebar
    passed days: 79
    the progress of the year: 22%
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░22%

    Github:
    https://github.com/Neulana/datebar

    喜欢自取,能赏个 star 就更好啦!比心

    24 replies    2018-03-21 13:36:14 +08:00
    Williamwang
        1
    Williamwang  
       Mar 21, 2018 via iPhone
    手机下载即刻 app,关注对应主题,并开启推送就搞定了……
    TimCheng
        2
    TimCheng  
       Mar 21, 2018 via iPhone
    等着接我的 star 吧
    0xABCD
        3
    0xABCD  
    OP
       Mar 21, 2018 via Android
    @Williamwang 回头下一个试试
    0xABCD
        4
    0xABCD  
    OP
       Mar 21, 2018 via Android
    gimp
        5
    gimp  
       Mar 21, 2018   ❤️ 1
    gihnius
        6
    gihnius  
       Mar 21, 2018
    写个 Ruby 的玩玩:
    percent = ((Time.now.yday.to_f / Time.now.at_end_of_year.yday) * 100).round
    bar = '▓' * percent + '░' * (100 - percent)
    puts "Progress of this year:"
    puts(bar + percent.to_s + '%')

    输出:
    Progress of this year:
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░22%
    anson2416
        7
    anson2416  
       Mar 21, 2018 via iPhone
    excel 能做吗
    326029212
        8
    326029212  
       Mar 21, 2018
    测试对 python2 稍有不兼容.随手提了个合并
    ZeroW
        9
    ZeroW  
       Mar 21, 2018 via Android
    @Williamwang 什么意思,好像不太明白~
    jasonyang9
        10
    jasonyang9  
       Mar 21, 2018
    坐等 PHP 版
    gihnius
        11
    gihnius  
       Mar 21, 2018
    再写个 Go 的:
    package main

    import (
    "fmt"
    "math"
    "strings"
    "time"
    )

    func main() {
    now := time.Now()
    passed := now.YearDay()
    format := "2006-01-02 15:04:05"
    end, _ := time.Parse(format, fmt.Sprintf("%d-12-31 23:59:59", now.Year()))
    total := end.YearDay()
    progress := math.Round((float64(passed) / float64(total)) * 100)
    bar := strings.Repeat("▓", int(progress)) + strings.Repeat("░", (100-int(progress)))
    fmt.Printf("Progress of this year %d of %d:\n", passed, total)
    fmt.Println(bar)
    }

    感觉够折腾的。。。。。
    clino
        12
    clino  
       Mar 21, 2018
    0xABCD
        13
    0xABCD  
    OP
       Mar 21, 2018 via Android
    @gihnius 感觉 Ruby 跟 Python 真的很像啊
    0xABCD
        14
    0xABCD  
    OP
       Mar 21, 2018 via Android
    @326029212 多谢了
    0vels
        15
    0vels  
       Mar 21, 2018
    之前做过一个农历版的,代码太烂,不好意思贴地址了
    0xABCD
        16
    0xABCD  
    OP
       Mar 21, 2018 via Android
    @gihnius 为你的折腾精神点赞👍
    lrxiao
        17
    lrxiao  
       Mar 21, 2018
    Gja5kx2zjf92LLin
        18
    Gja5kx2zjf92LLin  
       Mar 21, 2018
    可以 fork 吗?
    0xABCD
        19
    0xABCD  
    OP
       Mar 21, 2018 via Android
    @lixycoderfix 当然
    Williamwang
        20
    Williamwang  
       Mar 21, 2018 via iPhone
    @zerowang317 #9 即刻 app 有对应的提醒主题
    gihnius
        21
    gihnius  
       Mar 21, 2018
    @0xABCD Go 版运行快很多。。。
    gihnius
        22
    gihnius  
       Mar 21, 2018
    gihnius
        23
    gihnius  
       Mar 21, 2018
    @gihnius 继续玩:

    Go 版加了:

    ■■■■■■■■■■■■■■■■■■■■■
    ■■■■■■■■■■■■■■■■■■■■■
    ■■■■■■■■■■■■■■■■■■■■■
    ■■■■■■■■■■■■■■■■■□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□□□□□□□□□□□□□□
    □□□□□□□□ 22%(80/365)
    scriptB0y
        24
    scriptB0y  
       Mar 21, 2018
    今年还要工作多少天 Twitter 机器人:

    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1406 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 16:52 · PVG 00:52 · LAX 09:52 · JFK 12:52
    ♥ Do have faith in what you're doing.