推荐学习书目
› 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
katyang
V2EX  ›  Python

把英制转换成公制的 python 工具?

  •  
  •   katyang · Sep 27, 2016 · 4195 views
    This topic created in 3693 days ago, the information mentioned may be changed or developed.
    要进行一些文字处理
    有没有什么现成的工具,可以把英制转换称公制,
    把美元转换成人民币的?
    谢谢
    6 replies  •  2016-10-09 13:57:56 +08:00
    a87150
    a87150
    Sep 27, 2016
    1
    自己写几个函数就行了吧,你是懒到什么地步
    wjidea
    wjidea
    Sep 27, 2016
    2
    提供一个思路, 用 Python dict 来实现。

    SI = {'mm':0.001, 'cm':0.01, 'm':1.0, 'km':1000}

    def convert_SI(val, unit1, unit2):
    return val*SI[unit1]/SI[unit2]

    http://stackoverflow.com/questions/32091117/simple-unit-converter-in-python
    sherlocktheplant
    sherlocktheplant
    Sep 27, 2016
    3
    你发帖的时间 长度转换就已经写完了
    woostundy
    woostundy
    Sep 28, 2016
    4
    英制转公制好转,乘以系数就行。
    美元转人民币可复杂了,汇率很复杂。
    katyang
    katyang
    OP
    Sep 30, 2016
    5
    @wjidea 谢谢
    @woostundy 就是,这样的东西居然没有现成的,难道要我 requests +selenium 动态网页获取?
    woostundy
    woostundy
    Oct 9, 2016
    6
    @katyang 当然不会有现成的咯,汇率每天都在改变,而且不同银行不一样,而且买入和卖出价也不一样,怎么可能有免费现成的。
    路透社到时有,但得一年几十万买。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1447 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 10:30 · PVG 18:30 · LAX 02:30 · JFK 05:30
    ♥ Do have faith in what you're doing.