#!/usr/bin/python3 import argparse vokaler = "aouåeiyäöAOUÅEIYÄÖ" konsonanter = "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ" def viskspraket(text): """Removes all vowels from the sentence""" return "".join([x if x not in vokaler else "" for x in text]) def rovarspraket(text): """Consonants are doubled and "o" is put inbetween them""" return "".join([x + "o" + x if x in konsonanter else x for x in text]) parser = argparse.ArgumentParser() parser.add_argument("-r", help="rovarspraket", action="store_true") parser.add_argument("-v", help="viskspraket", action="store_true") args = parser.parse_args() textFromTerminal = input() print(textFromTerminal) if args.r: print(rovarspraket(textFromTerminal)) elif args.v: print(viskspraket(textFromTerminal))
This is the python script that I've written and I need to be able to translate a already translated string from bash. This is what I'm doing currently to translate a string:
$ echo "random string"|./translation.py -r
And the output is then:
roranondodomom sostotrorinongog
Now, if I wanted to translate "random string" first to rovarspraket and then to viskspraket. So "roranondodomom sostotrorinongog" is what I now want to translate. Is there a way to do this without copying and pasting and just repeating the same prodeduce but with "-v" as the command parameter instead of "-r".
I tried double piping:
$ echo "random string"|./translation.py -r |./translation.py -v
But that seems to simply igonore the first pipe?