From 5d6332af70ea74192f4f378f7955219caff2267a Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 13 Jan 2023 19:30:37 +0100 Subject: [PATCH] Add missing clean-str-dups script Signed-off-by: Knut Ahlers --- bin/clean-str-dups.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 bin/clean-str-dups.py diff --git a/bin/clean-str-dups.py b/bin/clean-str-dups.py new file mode 100755 index 0000000..172981c --- /dev/null +++ b/bin/clean-str-dups.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import os +import sys + + +def main(args): + sep = args[1] + in_str = args[2] + out = [] + + [ + out.append(i) + for i in in_str.split(sep) + if not out.count(i) + ] + + print(sep.join(out)) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv))