[Introduction] Insert line breaks in Python 3

When using a line feed code

str = 'Good morning\n Hello\n Good evening\n'
print(str)

#Good morning
#Hello
#Good evening
str = 'Good morning\r\n Hello\r\n Good evening\r\n'
print(str)

#Good morning
#Hello
#Good evening

When not using a line feed code

--Triple quotation

str = '''Good morning
Hello
Good evening'''
print(str)

#Good morning
#Hello
#Good evening

Single quotes or double quotes Be careful as Python gets angry

Recommended Posts

[Introduction] Insert line breaks in Python 3
Insert a date without line breaks in CotEditor
Fizzbuzz in Python (in one line)
python> print> N line breaks> print ('\ n'* 3)> 4 line breaks> print ('\ n'* 3),> 3 line breaks
[Python] Insert ":" in MAC address
Try LINE Notify in Python
Design Patterns in Python: Introduction
Make python segfault in one line
Display character strings without line breaks in python (personal memo)
Print with python3 without line breaks
Implemented in 1 minute! LINE Notify in Python
Make the line breaks visible in journalctrl
[Introduction to Python] How to use class in Python?
CGI server (1) python edition in one line
General Theory of Relativity in Python: Introduction
Line graphs and scale lines in python
Read the file line by line in Python
Read the file line by line in Python
Change line breaks in iPython autoformatted output
Decompose command arguments in one line in Python
[Python] Invert bool value in one line
[Python] Read the specified line in the file
Introduction to Vectors: Linear Algebra in Python <1>
Introduction to Effectiveness Verification Chapter 1 in Python
Quadtree in Python --2
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
Introduction of Python
SendKeys in Python
Meta-analysis in Python
Unittest in python
Discord in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
LINE heroku python
Lifegame in Python.
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python