Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How can we combine multiple print statements per line in Python?
You can combine multiple print statements per line using, in Python 2 and use the end argument to print function in Python 3.
example
Python2.x
print "Hello",
print " world"
Python3.x
print ("Hello", end='')
print (" world")
Output
This will give the output −
Hello world
Another thing you could do is put all the things in an array and call ''.join(array).
example
arr = ["Hello", "world"]
print(' '.join(arr))
Output
This will give the output −
Hello world
Advertisements
