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

to_csv(f'{self.output_dir}/{row["code"]}.{row["code_name"]}.csv', index=False)这里面的 code_name 中包含*这里报错要怎么处理啊。

  •  
  •   cico98 · May 18, 2020 · 3006 views
    This topic created in 2186 days ago, the information mentioned may be changed or developed.
    4 replies    2020-05-18 23:50:22 +08:00
    renmu
        1
    renmu  
       May 18, 2020 via Android
    不能做文件名的符号用个函数都过滤掉就好了
    customsshen
        2
    customsshen  
       May 18, 2020
    随便整一个相对路径文件名不行吗?
    ClericPy
        3
    ClericPy  
       May 18, 2020
    我直接无脑 re.sub(r'[^ \w]+', '_', name).strip() 替换了... 懒得去对比不同操作系统的安全文件名符号列表
    Trim21
        4
    Trim21  
       May 18, 2020 via Android
    那就用 replace 把星号删掉啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1404 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 17:06 · PVG 01:06 · LAX 10:06 · JFK 13:06
    ♥ Do have faith in what you're doing.