【发布时间】:2018-06-15 22:33:44
【问题描述】:
我是 Python 编码的新手。 我需要在包含特定单词的行中添加新列。 我的 csv 文件如下:
one two three four five
two one five three four
five two four three five
我需要在第二列中包含“two”的所有行中添加“2”。
像这样:
one two three four five 2
two one five three four
five two four three five 2
提前致谢
【问题讨论】:
-
这不是 CSV 文件。你试过什么?请先显示您的代码,并说明您的具体问题。那么我们也许可以提供帮助。
-
如果添加到列中,则不能将列添加到某些行,它将成为每一行的一部分。