V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
Skiro
V2EX  ›  Python

[求助] 请问如何利用 pypinyin 模块将汉字转为拼音后拼接至网址中?

  •  
  •   Skiro · Apr 12, 2020 · 2838 views
    This topic created in 2218 days ago, the information mentioned may be changed or developed.

    如何利用 pypinyin 模块将汉字转为拼音后拼接至网址中?

    pompeii
        1
    pompeii  
       Apr 12, 2020
    为何不把两个 URL 打印出来看看呢
    lsvih
        2
    lsvih  
       Apr 12, 2020
    你这一个 202001.html 一个 index.html 肯定不会相等呀
    Skiro
        3
    Skiro  
    OP
       Apr 12, 2020
    不好意思,target_url 复制错了
    ```
    for year_month in range(201901,201903):
    data_url = "http://lishi.tianqi.com/"+str(Pinyin("北京"))+"/" + str(year_month) + ".html"
    ```
    爬每个月的天气数据总是报错
    Cursor1st
        4
    Cursor1st  
       Apr 13, 2020
    你把报错信息发一下
    Cursor1st
        5
    Cursor1st  
       Apr 13, 2020
    这是我运行的,是对的呀
    ![2020-04-13_144648.png]( )
    ![2020-04-13_144659.png]( )
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1608 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 16:36 · PVG 00:36 · LAX 09:36 · JFK 12:36
    ♥ Do have faith in what you're doing.