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

Python 的数字字符串类型清洗有什么好方法吗?

  •  
  •   kidlfy · Dec 29, 2018 · 1902 views
    This topic created in 2779 days ago, the information mentioned may be changed or developed.

    最近一直在处理 字符串类型的数字 比如‘ 19 万 4000 ’转为 194000 这样的整形 我只会采用笨方法转换 来问问大佬们都有什么好方法 处理字符串转数字 先谢~

    4 replies    2018-12-29 17:11:28 +08:00
    likuku
        1
    likuku  
       Dec 29, 2018
    Google 搜 “ python 汉字转阿拉伯数字” 可有很多参考结果,下面只列出一个有 github 项目的案例:

    python 工具脚本:chinese_digit.py - 中文数字 转换为 阿拉伯数字 | Binuxの杂货铺 :
    https://binux.blog/2011/03/python-tools-chinese-digit/
    C0VN
        2
    C0VN  
       Dec 29, 2018
    是什么笨办法呢?
    kidlfy
        3
    kidlfy  
    OP
       Dec 29, 2018
    @xavierskip 就是分割 然后 int 转换 再加起来 这种 基本操作🤦‍♀️
    kidlfy
        4
    kidlfy  
    OP
       Dec 29, 2018
    @likuku 感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2402 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 00:41 · PVG 08:41 · LAX 17:41 · JFK 20:41
    ♥ Do have faith in what you're doing.