首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
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
V2EX
›
Python
Python 爬虫中怎么讲 url 地址转义为文件名?
wyy
·
2018 年 3 月 15 日
· 4212 次点击
这是一个创建于 2864 天前的主题,其中的信息可能已经有所发展或是发生改变。
Python
URL
地址
文件
7 条回复
•
2018-03-15 17:34:31 +08:00
1
julyclyde
2018 年 3 月 15 日
什么文件的名?
2
wyy
OP
2018 年 3 月 15 日
1
urllib 中的 urlencode 就可以了,注意要用字典的形式作为输入 value
3
wyy
OP
2018 年 3 月 15 日
@
julyclyde
windows 系统中合法的文件名
4
tarekyoog
2018 年 3 月 15 日 via Android
url.split('/')[-1]
5
netChen
2018 年 3 月 15 日
网址中的‘.’在 Windows 系统中应该不能做文件名
6
binux
2018 年 3 月 15 日
你要自己定一个转义规则
7
Arthur2e5
2018 年 3 月 15 日 via Android
@
netChen
当然可以。你下载个 bash-4.4.tar.gz 试试?
@
wyy
urlencode 按 URL 合法性的会错过冒号之类一堆东西,闭着眼睛直接搞的又嫌浪费路径长度…还是需要自己列字符就是
关于
·
帮助文档
·
自助推广系统
·
博客
·
API
·
FAQ
·
Solana
·
1164 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms ·
UTC 17:46
·
PVG 01:46
·
LAX 09:46
·
JFK 12:46
♥ Do have faith in what you're doing.
❯