Converting Strings to UPPERCASE ?
Sheila King
sheila at spamcop.net
Mon Sep 17 23:43:16 EDT 2001
On Tue, 18 Sep 2001 13:15:58 +1000, "Peter Moscatt"
<pmoscatt at iprimus.com.au> wrote in comp.lang.python in article
<3ba6bd0e at news.iprimus.com.au>:
:I am having difficulty in converting a string to Upercase - how is this best
:achieved ??
mystring = 'cat'
mystring = mystring.upper()
print mystring
The above will work in Python 2.0+
If you are using an older version:
import sting
mystring = 'cat'
mystring = string.upper(mystring)
print mystring
The above will work in all version of Python since 1.5 at least (and
probably before that, too, but you shouldn't be running anything older
than that).
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
More information about the Python-list
mailing list