重複の可能性:
Python リストで重複を検索して一覧表示する
私はPythonでこのスクリプトを持っています:
routes = Trayect.objects.extra(where=['point_id IN (10,59)'])
for route in routes:
print route
私はこの応答を受け取ります:
6 106 114 110 118 158 210 110 102 105 110 120 195 106
ご指摘のとおり、「110」ルートは 3 回繰り返され、「106」ルートは 2 回繰り返されます。
繰り返し数だけを取得するにはどうすればよいですか?
110と106のみが必要で、他は必要ありません。これだけ:
106 110
私は英語のネイティブ スピーカーではなく、python を学んでいます。ありがとう
***リスト内のオブジェクトは文字列です