literals in python- part-1 string literals in python|hmtech

preview_player
Показать описание
literals in python-literals is defined as data given to the variable in python.
Python support these literals-

Int literal :: 0,1,2,-1,-2
Long literal :: 89675L
Float literal :: 3.14
Complex literal :: 12j
Boolean literal :: True or False
Special literal :: None
Unicode literal :: u"hello"
List literal :: [], [5,6,7]
Tuple literal :: (), (9,),(8,9,0)
Dict literal :: {}, {'x':1}
Set literal :: {8,9,10}

string literal in python-if we assign string value in a variable than the string value is called string literal.
There are 2 types of String Literal-
(1) single line string
(2) multi line string

escape sequence in python-
(1)\ (2)\’ (3)\” (4)\a (5)\b
(6)\f (7)\n (8)\r (9)\t (10)\v (11)\0,\000
(12)\ooo (13)\xhh... (14)\uxxxx
(15)\Uxxxxxxxx (16)\N{name}

ord function in python3-Given a string of length one, return an integer representing the Unicode code point of the character when the argument is a unicode object.

raw string in python-
If you want the escape sequence character(\) works normally other character does than we use as prefix r or R before writing the statement and this string is called raw string.
print() function in python-
if you like this video please follow our facebook page -
Рекомендации по теме
visit shbcf.ru