banana/text2banana.py
2020-09-24 01:29:17 +02:00

20 lines
435 B
Python
Executable file

#!/usr/bin/env python3
import argparse
import re
import sys
import banana
def callback(x):
return " %s " % banana.dec2banana(int(x[0], base=10)).upper()
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Convert a text from dec to uppercase banana"
)
args = parser.parse_args()
text = sys.stdin.read()
text = re.sub(r"[0-9][0-9]*", callback, text)
sys.stdout.write(text)