Skip to main content

Python String

It is sequence of character. In other words, it is the collection of the characters surrounded by single quotes, double quotes, or triple quotes. Generally, triple quotes are used  to represent multiline strings and docstrings.

'hello' is the same as "hello". You can display a string literal with the print() function.

The computer does not understand the characters; internally, it stores manipulated character as the combination of the 0's and 1's. These character are encoded  with ASCII or Unicode.

Example: Single Quotes

Str = 'Welcome to ProgramsBuzz'

Output: Welcome to ProgramsBuzz

Example: Double Quotes

str_1 = "Welcome to ProgramsBuzz"

Output: Welcome to ProgramsBuzz

Example: Triple Quotes

str_1='''Welcome to ProgramsBuzz'''

Output: Welcome to ProgramsBuzz

Submitted by devanshi.srivastava on June 9, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.