Skip to content

Instantly share code, notes, and snippets.

@segfo
Created January 14, 2017 02:19
Show Gist options
  • Save segfo/e65748b5a77ed9da74e98d732a797389 to your computer and use it in GitHub Desktop.
Save segfo/e65748b5a77ed9da74e98d732a797389 to your computer and use it in GitHub Desktop.
重複したものを削除
#!/usr/bin/env python
#-*- coding: utf-8 -*-
a = ["abc","def","cdf","abc","abb"]
b = ["abc","def","cdf","abb","zbjl","klgjh","43whyur"]
def dupDel(seq):
seen = set()
seen_add = seen.add
return [ x for x in seq if x not in seen and not seen_add(x)]
for e in dupDel(a): b.remove(e)
print b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment