【问题标题】:unable to import UnicodeWriter python 2.7无法导入 UnicodeWriter python 2.7
【发布时间】:2013-02-27 03:36:59
【问题描述】:

我正在尝试将包含带有 unicode 字符的值的字典写入文本文件,并且正在考虑使用 python csv 文档中提到的 UnicodeWriter。但我无法导入它,因为 python 无法识别该模块。我想知道这是否是我的python版本的问题?另外,如果不能这样做,有没有办法在 python 中使用 dictWriter 类时指定编码。

【问题讨论】:

  • 很难说这里问了什么

标签: python csv unicode dictionary


【解决方案1】:

UnicodeWriter 不是任何 Python 版本中的实际模块。文档中给出的代码是一个示例,您必须将其复制到您自己的项目中。

【讨论】:

  • 哦,这实际上是有道理的!谢谢。我想我被几个问题误导了,其中有如下陈述:从 UnicodeWriter 导入 UnicodeWriter。谢谢。
  • 请提供链接。谢谢。
  • 供将来参考:链接到提到的文档示例:docs.python.org/2/library/csv.html#examples
猜你喜欢
  • 2011-04-29
  • 2015-09-13
  • 1970-01-01
  • 2012-08-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-14
相关资源
最近更新 更多