Login

Register

Login

Register

✆+91-9916812177 | contact@beingdatum.com

Python Strings

Anything written in single or double quotes is treated as a string in Python.

Like, we have str1 declared as ‘BeingDatum’ in single quotes, and str2 declared as “Let there be peace!!” in double quotes, Python treats both as String variables.

 

                 

Now, let’s see how can we extract individual characters from a string.

So, I’d want to extract the first two characters from ‘str1’ which I have created above:

Now, similarly, let’s extract the last two characters from str1:

Now, let’s head on to tuples in Python.

SEE ALL Add a note
YOU
Add your Comment
 
X