texttoecho
This commit is contained in:
parent
547087d8c7
commit
6a4d48059e
1 changed files with 45 additions and 0 deletions
45
texttoecho.py
Normal file
45
texttoecho.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# **************************************************************
|
||||
# Convert text to multiple echos
|
||||
# **************************************************************
|
||||
#
|
||||
# Author: Nick Aliferopoulos
|
||||
# aliferopoulos@icloud.com
|
||||
#
|
||||
|
||||
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
|
||||
|
||||
class TextToEcho(object):
|
||||
def __init__(self, prefix, suffix):
|
||||
self.prefix = prefix
|
||||
self.suffix = suffix
|
||||
|
||||
def convert(self):
|
||||
print("Type away! :)")
|
||||
|
||||
final = ""
|
||||
print "\t",
|
||||
text = raw_input()
|
||||
|
||||
while(text != ""):
|
||||
final = final + self.prefix + text + self.suffix + "\n"
|
||||
print "\t",
|
||||
text = raw_input()
|
||||
|
||||
print("Done! Here are your echos!")
|
||||
print("")
|
||||
print(final)
|
||||
|
||||
def main():
|
||||
parser = ArgumentParser(description='Text to Echo', formatter_class = ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('-v', '--version', action = 'version', version = '%(prog)s 1.0')
|
||||
parser.add_argument('-p', '--prefix', default = 'echo \"', required = False, help = 'Line prefix')
|
||||
parser.add_argument('-s', '--suffix', default = "\"", required = False, help = 'Line suffix')
|
||||
args = parser.parse_args()
|
||||
|
||||
tte = TextToEcho(args.prefix, args.suffix)
|
||||
tte.convert()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in a new issue