You are on page 1of 1

Python Strings

Creating a String
s1="Mahesh";

Printing String
print s1; or pring "Value of S1",s1;

Strings and text processing is very vast field and this reference card is not enough to cover everything. This reference card is just an attempt to help newbies get started with strings and text processing.

String Concatenation
s2="Hello! "; s2+=s1; Or s3=s2+s1;

Swapcase
"This is Demo".swapcase()

Length of the String


l="this is string"; len(l);

Spliting Text
"Break this".split()

Strip Strings
"Break text".rstrip() "*** Title ***".strip('*')

String Conditionals
m="this is another text"; m.endswith('text');

Upper & Lower Case


'this is just demo'.upper() 'THIS IS JUST DEMO'.lower()

Check onecore.net for more updated ref cards and tutorials.

http://onecore.net

You might also like