By printing multiple values separated by a comma:

print "I have", card.price

The print statement will output each expression separated by spaces, followed by a newline.

If you need more complex formatting, use the ''.format() method:

print "I have: {0.price}".format(card)

or by using the older and semi-deprecated % string formatting operator.

Answer from Martijn Pieters on Stack Overflow
🌐
Mimo
mimo.org β€Ί glossary β€Ί python β€Ί print-function
Explore Python's print() function, master output customization
Start your coding journey with Python. Learn basics, data types, control flow, and more ... # 1. Print a simple text string print("Hello, World!") # Outputs: Hello, World! # 2. Print the value of a variable name = "Alice" print(name) # Outputs: Alice # 3. Print multiple items at once age = 30 print("Name:", name, "Age:", age) # Outputs: Name: Alice Age: 30 # 4.
🌐
W3Schools
w3schools.com β€Ί python β€Ί python_strings.asp
Python Strings
Strings in python are surrounded by either single quotation marks, or double quotation marks. ... print("It's alright") print("He is called 'Johnny'") print('He is called "Johnny"') Try it Yourself Β»
🌐
Stanford CS
cs.stanford.edu β€Ί people β€Ί nick β€Ί py β€Ί python-print.html
print() and Standard Out
The Python print() function takes in any number of parameters, and prints them out on one line of text. The items are each converted to text form, separated by spaces, and there is a single '\n' at the end (the "newline" char). When called with zero parameters, print() just prints the '\n' ...
🌐
freeCodeCamp
freecodecamp.org β€Ί news β€Ί python-print-variable-how-to-print-a-string-and-variable
Python Print Variable – How to Print a String and Variable
December 7, 2021 - To print anything in Python, you use the print() function – that is the print keyword followed by a set of opening and closing parentheses,(). #how to print a string print("Hello world") #how to print an integer print(7) #how to print a variable ...
🌐
Python documentation
docs.python.org β€Ί 3 β€Ί tutorial β€Ί inputoutput.html
7. Input and output β€” Python 3.15.0 documentation
Formatted string literals (also called f-strings for short) let you include the value of Python expressions inside a string by prefixing the string with f or F and writing expressions as {expression}. An optional format specifier can follow the expression. This allows greater control over how the value is formatted. The following example rounds pi to three places after the decimal: >>> import math >>> print(f'The value of pi is approximately {math.pi:.3f}.') The value of pi is approximately 3.142.
🌐
w3resource
w3resource.com β€Ί python β€Ί python-print-statement.php
Python print() function
name = "Tom" age = 25 print("Hello, %s. You are %d years old." % (name, age)) ... Hello, Tom. You are 25 years old. ... Strings can be assigned to variable say string1 and string2 which can called when using the print statement.
🌐
Real Python
realpython.com β€Ί python-print
Your Guide to the Python print() Function – Real Python
July 3, 2026 - The code snippet above runs within an interactive Python REPL, as indicated by the prompt (>>>). Because the REPL executes each line of Python code immediately, you see a blank line right after calling print(). On the other hand, when you skip the trailing parentheses, you get to see a string representation of the print() function itself.
Find elsewhere
🌐
LabEx
labex.io β€Ί questions β€Ί how-to-print-a-python-string-271597
How to Print Strings in Python | LabEx
July 25, 2024 - The simplest way to print a string in Python is to use the print() function and pass the string as an argument.
🌐
Note.nkmk.me
note.nkmk.me β€Ί home β€Ί python
How to Use print() in Python | note.nkmk.me
May 10, 2023 - This article focuses on the Python 3 print() function. You can display strings or numbers by passing them as arguments to the print() function.
🌐
Jeremy Morgan
jeremymorgan.com β€Ί python β€Ί how-to-print-a-string-and-a-variable-in-python
How to Print a String and a Variable in Python
To print a string and a variable in Python, you can use the print() function. The print() function takes one or more arguments, which are separated by commas. The first argument is the string to be printed, followed by any number of variables.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί how-to-print-string-and-int-in-the-same-line-in-python
How to Print String and Int in the Same Line in Python - GeeksforGeeks
July 23, 2025 - In this code, we use the map() function to convert all elements in the data list to strings, and then we use the join() method to combine them with a space delimiter. ... name = "John" age = 30 print("My name is", name, "and I am", age, "years old.")
🌐
Learn Python
learnpython.org β€Ί en β€Ί String_Formatting
String Formatting - Learn Python - Free Interactive Python Tutorial
% (name, age)) Any object which is not a string can be formatted using the %s operator as well. The string which returns from the "repr" method of that object is formatted as the string.
🌐
Medium
medium.com β€Ί @DoneWithWork β€Ί 5-different-ways-to-print-in-python-17528bb5c173
5 Different Ways to Print in Python | by DoneWithWork | Medium
May 2, 2023 - # Example 1: Printing a string print("Hello, World!") # Output: Hello, World! # Example 2: Printing a variable x = 42 print(x) # Output: 42 Β· String formatting is a powerful technique that allows you to insert values into a string. In Python, you can use the β€˜%’ operator to format a string.
🌐
Umn
docs.cems.umn.edu β€Ί intro β€Ί Prt_01_Lssn_04_Using_Strings_and_Print().html
5. Using Strings and print() β€” Intro to Scientific Python
Here, we see that the 25th indexed position is called for the first position, but nothing is included after the : symbol. The Python shell interprets this as to read to the end of the string. This is why the print() command displays everything starting from M (i.e., the 25th indexed position in cems) to the last character !.
🌐
Medium
medium.com β€Ί gustavorsantos β€Ί f-string-the-easiest-way-to-print-in-python-82f9aca01855
F-string: the easiest way to print() in Python - gustavorsantos - Medium
December 8, 2022 - It is even easier than use the still popular .format( ). The syntax is simple: just add the letter f before opening the quotes and place your variables inside curly braces. ... Comparison between .format( ) and f-string syntax.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί python-output-using-print-function
Python - Print Output using print() function - GeeksforGeeks
You can pass variables, strings, numbers, or other data types as one or more parameters when using the print() function. Then, these parameters are represented as strings by their respective str() functions.
Published: July 11, 2025
🌐
Python Programming
pythonprogramming.net β€Ί python-tutorial-print-function-strings
Python Programming Tutorials
If you use a "+", then the strings will be strung together with no space. You will need to add one if you wanted. If you use the "+" to join integers and floats together, then you will perform an arithmetic operation. If you use the ",", then it will print them out separately, with a space.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python-output-formatting
Python - Output Formatting - GeeksforGeeks
The string modulo operator (%) is one of the oldest ways to format strings in Python. It allows you to embed values within a string by placing format specifiers in the string. Each specifier starts with a % and ends with a character that represents the type of value being formatted. ... # string modulo operator(%) print("Geeks : -, Portal : %5.2f" % (1, 05.333)) print("Total students : =, Boys : -" % (240, 120)) # print integer value print("%7.3o" % (25)) # print octal value print(".3E" % (356.08977)) # print exponential value
Published: December 16, 2024