Oct. 04, 2012

Python : String Methods

String methods are working on the string its called from, if you have a string called, string = "Hello World", then the string method is called such this: string.string_method() . For a list of string methods, please look at one of my earlier post that is covering just that.
Let's have some fun now and show some examples:
string = "Hello World"

print string.isupper()
print string.upper()
print string.islower()
print string.isupper()
print string.capitalize()
print string.split()
print string.split(',')
print string.title()
print string.strip()
If you run that, it should give you an output like this:
Hello world
['Hello', 'World']
['Hello World']
Hello World
Hello World

Recommended Python Training – DataCamp

For Python training, our top recommendation is DataCamp.

Datacamp provides online interactive courses that combine interactive coding challenges with videos from top instructors in the field.

Datacamp has beginner to advanced Python training that programmers of all levels benefit from.


Read more about:
Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, PythonForBeginners.com only recommend products or services that we try personally and believe will add value to our readers.