[Tutor] some string operations
Kent Johnson
kent37 at tds.net
Sat Oct 4 13:28:10 CEST 2008
On Sat, Oct 4, 2008 at 4:03 AM, David <ldl08 at gmx.net> wrote:
> Dear list,
>
> one of the exercises in Zelle's book is:
>
> given
>
> import string
> s1 = "spam"
> s2 = "ni!"
>
> show a Python expression that could construct the following result by
> performing string operations on s1 and s2:
Note that most of the functions in the string module are also
available as string methods. The string methods are preferred, so
string.capitalize(s1)
is more idiomatically written as
s1.capitalize()
Kent
More information about the Tutor
mailing list