예제 #1
0
def normal():
    try:
        if args.in_file:
            with open(args.in_file) as file_in:
                text = file_in.read()
        else:
            text = input('Enter the text for constructing palindromes:\n')

        palindrome = Palindrome(text)
        list_pal = palindrome.create_list_pal()

        if args.out_file:
            with open(args.out_file, 'w') as file_out:
                file_out.write('\n'.join(list_pal))
        else:
            print('Constructed palindromes:')
            for i in list_pal:
                print(i)
    except Exception as e:
        sys.exit("Error: {0}".format(e))