我有一个文本文件,它由相似的行组成,很少有行与文本文件中的其他行一半相似
Input.txt
I would like to play: Volleyball
I would like to play: Volleyball
I would like to play: TableTennis
I would like to play: Baseball
I do not know how to play: Volleyball
She would like to play: TableTennis
I want to learn how to play: Baseball
They like to play: all the three
我想从输入文件中删除重复的行,如图所示
I would like to play: Volleyball
I would like to play: TableTennis
I would like to play: Baseball
I do not know how to play: Volleyball
She would like to play: TableTennis
I want to learn how to play: Baseball
They like to play: all three
我想从输入文件中删除重复的行,如图所示
I would like to play: Volleyball
I would like to play: TableTennis
I would like to play: Baseball
I do not know how to play: Volleyball
She would like to play: TableTennis
I want to learn how to play: Baseball
They like to play: all three
下一步:
I would like to play
They like to play
输出文件的简要说明 我想参加的声明涵盖了许多不同的运动,所以我想打印出来。他们喜欢玩的最后一行是另一种情况,所以我也想打印这一行。(我们如何将这些结果写入.csv格式,并在不同列中打印涵盖最多运动项目以及所有独特运动项目的报表)
注: 我不想打印 我不知道怎么打:排球 她想打乒乓球 我想学打棒球
因为已经报道了三项运动
我对我们如何在同一个文本文件中比较一行和另一行感到困惑。任何帮助都将不胜感激。多谢各位
这很简单,在“.py”文件中这样做:
你可以这样做:
或
相关问题 更多 >
编程相关推荐