What is used to represent Strings in Python? Is double quotes used for String representation or single quotes used for String representation in Python?
Submitted by: AdministratorUsing Single Quotes (')
You can specify strings using single quotes such as 'Quote me on this' . All white space i.e. spaces and tabs are preserved as-is.
Using Double Quotes (")
Strings in double quotes work exactly the same way as strings in single quotes. An example is "What's your name?"
Using Triple Quotes (''' or """)
You can specify multi-line strings using triple quotes. You can use single quotes and double quotes freely within the triple quotes. An example is
'''This is a multi-line string. This is the first line.
This is the second line.
"What's your name?," I asked.
He said "Bond, James Bond."
Submitted by: Administrator
You can specify strings using single quotes such as 'Quote me on this' . All white space i.e. spaces and tabs are preserved as-is.
Using Double Quotes (")
Strings in double quotes work exactly the same way as strings in single quotes. An example is "What's your name?"
Using Triple Quotes (''' or """)
You can specify multi-line strings using triple quotes. You can use single quotes and double quotes freely within the triple quotes. An example is
'''This is a multi-line string. This is the first line.
This is the second line.
"What's your name?," I asked.
He said "Bond, James Bond."
Submitted by: Administrator
Read Online Python Job Interview Questions And Answers
Top Python Questions
☺ | When do you use list vs. tuple vs. dictionary vs. set? |
☺ | What is python? |
☺ | What are uses of lambda? |
☺ | What is the optional statement used in a try except statement in Python? |
☺ | Do they know a tuple/list/dict when they see it? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |