Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I presume you are talking about string formatting. In this case, most Python tutorials will tell you how to format/replace strings inside of other strings with various variables. An example from one tutorial:

>>> name = 'Bob'
>>> 'Hello, %s' % name
"Hello, Bob"

Here is an example using interact to show computations nicely, which is a primary way to use string formatting in Sage usefully.

However, one should point out that the new-style formatting ('Hello, {}'.format(name) in the linked tutorial) is probably mostly recommended.