Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
みたいなファイルがあれば
1 1 5 3 3 45 45 87 6 6 4
次のような重複しない値のみを保存したい
5 87 4
コメントをお待ちしております。
あなたのコメントから、ファイルを読み取ってデータを取得できないようです。そのために次のコードを使用できます。
x=open("filename.txt").readlines()
そして、あなたのコードを使用することができます:
print [key for key, group in groupby(x) if len(list(group)) < 2]