String Continued... 

"This is double coted string"

""" This is Triple  coted string
used to flow across multi lines"""

Escape sequences :

        Suppose you want to write print ' I'm going to shop ' or print " I"m going to shop"  , this gives you error.. SyntaxError: invalid syntax    COZ  character   '   inside string identifiers   '    ' creates confusion to python interpreter.

So write it as print  ' I\'m going to shop '  or print "I\"m going to shop" or print "I'm going to shop"  (Single cotes inside double cotes doesn't make confusion)
 Likewise \" escape for " (double cotes) , \\ , \t (tabspace), \n (newline) .... 

print "Hello \n world"
>>> Hello
>>> world


Raw string :  

Just like Raw meat.. kiddin If you want to skip noncense processing of escape sequence just mention as

print r'"Hello \n world"
>>>Hello \n world
     
 If you want to print \n as it is without using escape sequence use raw string

 Usefull in web url processing, were user is going to give input in empty input field of your webpage like  

python.com\index\nextpage

 note that user wont give escape sequence for \ , so URL's are should be considered as raw string
else if you print user input it would print like 

python.com\index
extpage

 Unicode : 
Unicode in wiki Read this link for better understanding
Unicode is standard way of representation of all identified languages script and symbols.
The latest version of Unicode consists of a repertoire of more than 110,000 characters covering 100 Scripts
Python supports unicode, if you want to write kannada letter using python

print unichr(0x0C9x5)

Return the Unicode string version of value passed to the function
About unichr() > unichar by python.org

This is representation of unicode string u"This is unicode string"

Note:

Every object in Python is classified as immutable (unchangeable) or not. In terms of the core types, numbers, strings, and tuples are immutable where as  lists and dictionaries are not (they can be changed in-place freely). Among other things, immutability can be used to guarantee that an object remains constant throughout your program.


Example:
---------

1) print "Hello world" 
>>>Hello world


print "hai", " ", "there"
>>>hai there

2) I have mentioned earlier about "import" and  "from" keywords

import os
print dir(os)

on executing this code you will see hell lot of comma seperated strings, these are functions and variables which are available to use with class "os"

3)print os.curdir
gives you current working directory

4) >>> os.getpid
<built-in function getpid>  -->  getpid is function so you shuld call like below return process id


os.getpid()
>>>5391



Variables and value assignment

Variables are reserved memory locations to store value.
how to assign value to variable?

x = 10

x ---> variable
10 ---> value

print x
10

so how to create integer variable, string variable, or float variable?

In python easy than ever

x = 10        # integer assignment  x is integer variable
y = 10.0001   # Y is float variable
z = "hai"     # z is string

You cant do reverse operation
>>> 12 = t
  File "<stdin>", line 1
  SyntaxError: can't assign to literal

type()  --> prints what kind of variable it is

>>> a = "string"        # string assignment
>>> b = 10              # integer assignment
>>> c =2.8              # float assignment
>>> type(a)
<type 'str'>            # type string
>>> type(b)
<type 'int'>            # type int
>>> type(c)
<type 'float'>          # type float



Evaluate expression

>>> 2 + 2
4
>>> a, b = 10, 3
>>> a + b
13

What you cant do ?
Since x is integer and y is string you cant marry x with y.

>>> x, y = 4, "hai"
>>> x + y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>>


whats d Solution ?
convert variable  'x'  to string type
or y to integer :), this is not possible,  so we will convert x to string

>>> str(x) + y          # type casting
'4hai'

>>> int("4hai")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '4hai'

Explanation :  to convert string to integer the complete string argument to function int() should be number, 
in simple words no alphabets and special characters allowed

Use Int( )  like this.. 


>>> int("b", base=16)       Convert from hexadecimal to integer
11

>>> int("10110", base=2)    Convert from binary to integer
22

>>> int("101", base=10)      Convert from  decimal to decimal       CRAP :) :)
101

Multiple variable assignment

python is beautiful :)
Hope below examples explains every thing what i wanted to explain in words

a , b = 10, 20
>>> a , b = 10, 20
>>> a
10
>>> b
20


a , b = 10, "string"
>>> a , b = 10, "string"
>>> a
10
>>> b
'string'


a = b = c = 10
>>> a = b = c = 10
>>> a
10
>>> b
10
>>> c
10


More List, tuple and dictionary multiple assignment
Just remember this, I am going to explain about "LIST", "TUPLE" and "DICTIONARY" in upcoming chapters   :) 


>>> a, b = ['y',['x']]
>>> print a
y
>>> print b
['x']

>>> a, b = ('y',('x'))
>>> print a
y
>>> print b
x
>>> a, b = ('y',('x','v'))
>>> print a
y
>>> print b
('x', 'v')


>>> a, b = {"key1":"one","key2":"two"}
>>> print a          # dictionaries are dynamic ie. dictionary elements order are not same all the time
key2
>>> print b
key1
>>> print type(a)            # a and b are not dictionaries they are just strings
<type 'str'>


How to delete reference to the variables?
Just delete..   "del" keyword lets you delete variables, elements, objects .... etc

>>> c = 2.8
>>> c
2.8
>>> del c
>>> c
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'c' is not defined


Similarly delete any python objects you want