0 votes
in Python by
What do you mean by Python literals?

1 Answer

0 votes
by

Literals can be defined as a data which is given in a variable or constant. Python supports the following literals:

String Literals

String literals are formed by enclosing text in the single or double quotes. For example, string literals are string values.

Example:

  1. # in single quotes  
  2. single = 'Madanswer'  
  3. # in double quotes  
  4. double = "Madanswer"  
  5. # multi-line String  
  6. multi = '''''mad
  7.            T  
  8.                answer'''  
  9.     
  10. print(single)  
  11. print(double)  
  12. print(multi)  
...