Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

자바나라

[Python 기초] Print 자동 줄바꿈? 본문

오늘 배운 파이썬

[Python 기초] Print 자동 줄바꿈?

주데브 2018. 5. 18. 15:01
1
2
3
4
5
6
7
8
9
10
11
12
13
print('orange' 'banana' 'apple')
print('orange' + 'banana' + 'apple')
 
print('orange,' 'banana,' 'apple')
 
print('orange''banana''apple')  # 따옴표 밖의 콤마는 sep 의 기준, default 값은 공백으로 들어간다.
print('orange','banana','apple',sep="__")  # sep 되는 부분마다 넣을 기호 또는 문자를 지정해줄 수 있다.
 
 
print('orange','banana','apple' )   # 파이썬에서는 엔터만 쳐도 줄바꿈이 되는 것처럼 느껴졌는데 사실은 \n이 숨어있었다.
print('orange','banana','apple' , end='\n')  # end 의 default 값으로 \n 이 들어가 있고
print('orange','banana','apple' , end='--')  # end 값은 원하는 값으로 지정가능하다.
print('orange','banana','apple' , end='--')  # end 값을 지정해주면서 \n 가 없어지므로 자동 줄바꿈은 없어짐
cs


'오늘 배운 파이썬' 카테고리의 다른 글

[Python 기초] Set(셋)  (0) 2018.05.18
[Python 기초] List(리스트)  (0) 2018.05.18
[Python 기초] Unpacking(언패킹)  (0) 2018.05.18
[Python 기초] global 선언  (0) 2018.05.18
[Python 기초] 함수 설정  (0) 2018.05.18
Comments