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
bestehen
V2EX  ›  Python

Python 如何处理 写 csv 多了个双引号 如何处理 本来是“” 但是写入 csv 的时候编程““””

  •  
  •   bestehen · 2018-08-04 17:01:27 +08:00 · 4313 次点击
    这是一个创建于 2086 天前的主题,其中的信息可能已经有所发展或是发生改变。
    csv.writer(f, dialect="excel").writerow( [{"found_year":found_year,"jg_type":jg_type,"area":area,"source_gw_link":source_gw_link,"jianjie":jianjie,"lianxi":lianxi},{"company_news":company_news}, {"name":name,"sex":sex,"company":company,"position":position,"role" :role, "edu_experience":edu_experience,"work_experience": json.dumps(OrderedDict(sorted(work_experience.items()))).encode('utf-8').decode('unicode_escape')}, {"lingyu":lingyu,"jiguan":jiguan,"lunci":lunci,"jieduan":jieduan,"jieshao":jieshao,"money_type":money_type,"touzianlie":json.dumps(OrderedDict (sorted(tzanli.items()))).encode('utf-8').decode('unicode_escape')},{"person_news":json.dumps(OrderedDict(sorted(person_news.items()))).encode('utf-8').decode('unicode_escape')}])



    这段信息 其中的一段 我打印屏幕上 是这样的'news_date': '2018.7.17',后来就插入 csv 后就变成这样了
    ""news_date"": ""2018.7.26""
    5 条回复    2018-08-27 09:58:02 +08:00
    CEBBCAT
        1
    CEBBCAT  
       2018-08-04 18:59:47 +08:00
    ' '
    CEBBCAT
        2
    CEBBCAT  
       2018-08-04 19:05:36 +08:00
    @CEBBCAT 不行,老嘲讽显得不够意思,我觉好好看看楼主的帖子
    CEBBCAT
        3
    CEBBCAT  
       2018-08-04 19:53:52 +08:00
    CEBBCAT
        4
    CEBBCAT  
       2018-08-04 19:57:31 +08:00
    接 @CEBBCAT #3

    请楼主把代码全部贴上来,用到的数据也要上传,因为要测试,你的问题要截图,必要时录屏
    matrix273
        5
    matrix273  
       2018-08-27 09:58:02 +08:00 via Android
    pandas.read_csv
    pandas.to_csv
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2345 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:10 · PVG 00:10 · LAX 09:10 · JFK 12:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.