You have 3 options, string concatenation, and two styles of formatting:
>>> name = 'Sir Arthur'
>>> '.*' + name + '.*'
'.*Sir Arthur.*'
>>> '.*%s.*' % (name, )
'.*Sir Arthur.*'
>>> '.*{0}.*'.format(name)
'.*Sir Arthur.*'
>>> '.*{name}.*'.format(name=name)
'.*Sir Arthur.*'
The last two examples are different ways to accomplish the same thing.
HTH,
Wayne
Thanks for the suggestion. Very useful.
Tommy
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor