in this example:
>>> 'DevNet' + 'Rocks'
'DevNetRocks'Multiplication works as well, as in this example:
Click here to view code image
>>> 'DevNet Rocks ' * 5
'DevNet Rocks DevNet Rocks DevNet Rocks DevNet
Rocks DevNet Rocks 'There is a tremendous amount of string manipulation
you can do with Python, and there are a number of built-
in methods in the standard string library. These methods
are called with a dot after the variable name for a string.
Table 3-5 lists some commonly used string manipulation
methods, including the syntax used for each and what
each method does.
Table 3-5 String MethodsMethodWhat It Doesstr.capitalize() Capitalize the stringstr.center(width
[, fillchar])Center justify the stringstr.endwith(suffi
x[, start[, end]])Add an ending string to the stringstr.find(sub[,
start[, end]])Find the index position of the
characters in a stringstr.lstrip([chars]
)Remove whitespace characters from
the end of the string