andrewhk-nm / nm

Functions I create to help me at work
1 stars 1 forks source link

NetX COB: Personalized names #7

Open andrewhk-nm opened 6 years ago

andrewhk-nm commented 6 years ago

TODO: 2018-04-27 9.57a Perhaps some sort of way to put the person's name in the text? I don't want to start there though.

andrewhk-nm commented 6 years ago

Here are some experiments on how to accomplish this.

>>> '{pri} text is best!'.format('my')
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    '{pri} text is best!'.format('my')
KeyError: 'pri'
>>> '{pri} text is best!'.format({'pri': 'my'})
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    '{pri} text is best!'.format({'pri': 'my'})
KeyError: 'pri'
>>> '{pri} text is best!'.format(pri='my')
'my text is best!'
>>> '{Primary Account Holder} text is best!'.format(Primary='my')
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    '{Primary Account Holder} text is best!'.format(Primary='my')
KeyError: 'Primary Account Holder'
>>> '{Primary Account Holder} text is best!'.format(Primary Account Holder='my')
SyntaxError: invalid syntax
>>> '{Primary Account Holder} text is best!'.format(Primary_Account_Holder='my')
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    '{Primary Account Holder} text is best!'.format(Primary_Account_Holder='my')
KeyError: 'Primary Account Holder'
>>> '{PrimaryAccountHolder} text is best!'.format(PrimaryAccountHolder='my')
'my text is best!'
>>> 'any text is best!'.format(PrimaryAccountHolder='my')
'any text is best!'
>>> '{} any text is best!'.format(PrimaryAccountHolder='my')
Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    '{} any text is best!'.format(PrimaryAccountHolder='my')
IndexError: tuple index out of range