Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break up one print command in two lines of code in Python 3

I want to print one continuous message with two lines of code using print, how can I do this?

print('Hello how are you')
print('today?')

But this gives me

Hello how are you
today?

While I want

Hello how are you today?
like image 723
carcinogenic Avatar asked Apr 01 '14 16:04

carcinogenic


1 Answers

Use end=' ' to replace the newline with a space:

print('Hello how are you', end=' ')
print('today?')
like image 92
Martijn Pieters Avatar answered Sep 24 '22 16:09

Martijn Pieters