About 9,520 results
Open links in new tab
  1. python - Using quotation marks inside quotation marks - Stack Overflow

    When I want to do a print command in Python and I need to use quotation marks, I don't know how to do it without closing the string. For instance: print " "a word that needs quotation marks" "

  2. How to add quotation on a string for python? - Stack Overflow

    Oct 12, 2021 · Use single quotes around the original string, to make the other quotes - "" shown. You could also use a slash - \. This acts as an escape sequence. There are two methods to do this: The quotes need to be inserted explicitly in the string something like this. The outcome is.

  3. How to use quotes inside of a string - Python - GeeksforGeeks

    Dec 9, 2024 · Let us see a simple example of using quotes inside a String in Python. Now let’s explore other different methods to use quotes inside a String. Python escape sequence are used to add some special characters in to the String. One of …

  4. How to print a string that contains quotes in python

    May 7, 2019 · Escape the double quotes within the string: You can put a backslash character followed by a quote (\" or \'). This is called an escape sequence and Python will remove the backslash, and put just the quote in the string. print ("\"quotation marks\"") "quotation marks" Use triple-quoted strings: print (""" "quotation marks" """) "quotation marks"

  5. How to add Quotes to a String in Python - bobbyhadz

    Apr 8, 2024 · To add quotes to a string in Python: Alternate between single and double quotes. For example, to add double quotes to a string, wrap the string in single quotes.

  6. Single and Double Quotes | Python | GeeksforGeeks

    Mar 31, 2023 · There are two ways to represent strings in python. String is enclosed either with single quotes or double quotes. Both the ways (single or double quotes) are correct depending upon the requirement.

  7. How to Quote a String in Python - codingem.com

    To quote a string in Python use single quotation marks inside of double quotation marks or vice versa. For instance: example1 = "He said 'See ya' and closed the door."

  8. Python Strings - Python Guides

    In Python, a string is a sequence of characters enclosed within quotation marks. Python strings are immutable, which means once created, they cannot be changed. Creating Strings. ... By mastering Python strings, you’ll have a solid foundation for text processing, data manipulation, and many other programming tasks in Python.

  9. Master Quotation Marks in Python Strings with These Methods

    Feb 24, 2024 · Python provides great flexibility in defining strings, allowing the use of single quotes (') or doubles ("). This allows one type of quote to be inserted inside a string that is delimited by the other type. Let's look at some examples: To include single quotes within a string: phrase_with_simples = "This is a 'quote' within a string."

  10. Top 3 Efficient Methods to Use Quotation Marks Inside

    Nov 24, 2024 · One of the simplest ways to include quotation marks in a string is to use single quotes for the outer string and double quotes for the inner string. Here’s an example: print( '"A word that needs quotation marks"' )

  11. Some results have been removed