小编nik*_*osb的帖子

如何从csv文件获取唯一值

我有这个csv文件

Cat, and, dog, bites
Yahoo, news, claims, a, cat, mated, with, a, dog, and, produced, viable, offspring
Cat, killer, likely, is, a, big, dog
Professional, free, advice, on, dog, training, puppy, training
Cat, and, kitten, training, and, behavior
Dog, &, Cat, provides, dog, training, in Eugene, Oregon
Dog, and, cat, is, a, slang, term, used, by, police, officers, for, a, male-female, relationship
Shop, for, your, show, dog, grooming, and, pet, supplies
Run Code Online (Sandbox Code Playgroud)

我想使所有单词都以小写字母开头,并创建一个列表,其中将包含上述csv文件中的所有唯一项。你有什么主意吗 提前致谢!到目前为止,我已经设法将所有单词转换为一个小字母:

unique_row_items = set([field.strip().lower() for field in …
Run Code Online (Sandbox Code Playgroud)

python csv file list unique

0
推荐指数
1
解决办法
6679
查看次数

标签 统计

csv ×1

file ×1

list ×1

python ×1

unique ×1