s = 'ab = xy'
indx = s.find('=') #.rfind
part_one = s[:indx].strip()
part_two = s[indx + 1:].strip()
theText = "x={x x}, y={y y}"
theMap = {"x x" : 'X', "y y" : 'Y'}
theText.format(**theMap)
'X and Y values: {x_val}, {y_val}'.format(x_val ='33', y_val ='44')
date_str = "{theMonth}/{theDay}/{theYear}".format(
theMonth = month,
theDay = day,
theYear = year
)
theText = """
a
b
c
"""
theList = theText.split('\n')
theList = [1, 2, 3, 0]
>>> theList.sort()
>>> theList
[0, 1, 2, 3]
>>> thePoundStr = '##'.join(map(str, theList))
'0##1##2##3'
>>> theNumberList = map(int, thePoundStr.split('##'))
>>> theNumberList
[0, 1, 2, 3]
for i in reversed(range(1900, 2017)):
date_str = '1/1/{}'.format(i)
print date_str
>>> "Á".encode(encoding="ascii",errors="backslashreplace")
b'\\xc1'