REW

How Do You Print A String Without Double Quotes In Python?

Published Aug 29, 2025 4 min read
On this page

When printing a string variable or a string literal in Python, the built-in print() function will automatically display the string content without its surrounding double quotes. The quotes are part of the representation of the string, not the string's actual content. This is a crucial distinction to understand.

Quotes only appear in the output when you explicitly print the representation of a string or when you print a data structure (like a list or dictionary) that contains strings.

Here is a comprehensive guide covering various scenarios.

1. Basic printing of a string variable or literal

For most use cases, the standard print() function is all you need.

# Printing a string variable
my_string = "Hello, world!"
print(my_string)
# Printing a string literal directly
print("This is a test string.")

Use code with caution.

Output:

Hello, world!
This is a test string.

As shown, the output does not include the quotes.

2. Printing string contents from a list

When you print a list containing strings, the print() function displays the list's official representation, which includes the quotes around each string and the square brackets of the list. To print the string contents without this formatting, use a loop or the join() method.

Using a for loop

This approach prints each string element on a new line.

my_list = ["apple", "banana", "cherry"]
for item in my_list:
    print(item)

Use code with caution.

Output:

apple
banana
```cherry
### Using the `join()` method

The `join()` method concatenates all the strings in an iterable into a single string, using a specified separator. This is an efficient way to print all items on a single line.

```python
my_list = ["apple", "banana", "cherry"]
# Join with a space separator
print(" ".join(my_list))
# Join with a comma and space separator
print(", ".join(my_list))

Use code with caution.

Output:

apple banana cherry
apple, banana, cherry

Using the unpacking operator *

The * operator unpacks the list elements as individual arguments to the print() function, which prints them separated by a space by default.

my_list = ["apple", "banana", "cherry"]
print(*my_list)

Use code with caution.

Output:

apple banana cherry

3. Printing string values from a dictionary

Similar to lists, printing a dictionary directly will show the string keys and values with their quotes. To extract and print just the string content, you need to iterate through the dictionary's values.

my_dict = {"fruit_1": "apple", "fruit_2": "banana"}
# Using a for loop to print each value on a new line
for value in my_dict.values():
    print(value)
# Using join() on the dictionary's values to print on a single line
print(", ".join(my_dict.values()))

Use code with caution.

Output:

apple
banana
apple, banana

4. Removing embedded or surrounding quotes

Sometimes, a string may contain quotes as part of its content. To remove these, you can use built-in string methods like replace() or strip().

Using str.replace()

This method replaces all occurrences of a specified substring with another.

quoted_string = '"Python" is a great language.'
clean_string = quoted_string.replace('"', '')
print(clean_string)
# You can also use it to handle both single and double quotes
mixed_quotes = "'Hello, world!'"
clean_mixed = mixed_quotes.replace("'", "").replace('"', '')
print(clean_mixed)

Use code with caution.

Output:

Python is a great language.
Hello, world!

Using str.strip()

This method removes any leading and trailing characters specified in its argument. It's useful for strings that are only quoted at the beginning and end.

leading_trailing_quotes = '"Hello, World!"'
clean_edges = leading_trailing_quotes.strip('"')
print(clean_edges)

Use code with caution.

Output:

Hello, World!

Using regular expressions (re.sub)

For more complex patterns, the re module offers a powerful solution. This is especially useful for removing quotes that may appear anywhere in the string.

import re
quoted_text = 'She said, "The code is awesome!"'
clean_text = re.sub('"', '', quoted_text)
print(clean_text)

Use code with caution.

Output:

She said, The code is awesome!

5. Printing without quotes from the interactive prompt

In Python's interactive prompt (the >>> command line interface), simply typing a variable's name will print its representation, which includes quotes for strings. To get the unquoted output, you must use the print() function explicitly.

>>> my_string = "Hello"
>>> my_string
'Hello'
>>> print(my_string)
Hello
Enjoyed this article? Share it with a friend.