-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxlate_demo_usage.py
39 lines (33 loc) · 1.17 KB
/
xlate_demo_usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Dec 13, 2018
@author: Erik Pohl
'''
from xlate import xlate
input_string = 'pohl erik 9/2/72 python arlington'
input_del = ' '
input_format = ['lname', 'fname', 'bdate', 'language_of_choice', 'hometown']
output_format = '{fname} {lname}, born on {bdate}, ' \
'lives in {hometown} and prefers {language_of_choice}'
demo_usage = xlate(
xlate_input_delimiter=input_del,
xlate_input_format=input_format,
xlate_output_format=output_format
)
print(demo_usage.to_string_using_keyword_format(input_string))
print(demo_usage.to_dictionary(input_string))
output_format = '{0} {1}, born on {2}, lives in {3} and prefers {4}'
demo_usage = xlate(
xlate_input_delimiter=input_del,
xlate_output_format=output_format
)
print(demo_usage.to_string_using_keyword_format(input_string))
print(demo_usage.to_dictionary(input_string))
output_format = '{fname} {lname}, born on {bdate}, ' \
'lives in {hometown} and prefers {language_of_choice}'
demo_usage = xlate(
xlate_input_delimiter=input_del,
xlate_output_format=output_format
)
print(demo_usage.to_string_forcing_positional(input_string))