본문 바로가기
Programming Study

[파이썬 python] print 함수 총정리

by White,,JY 2021. 9. 6.
728x90
300x250

 

Hello World 출력하기 : 문자열은 "" or '' 로 표현 가능
print("Hello World")
print('Hello World')

 

여러 데이터 출력하기 : 1212, 2323 출력
print("1212", "2323")

 

공백 대신 문자열을 결합하여 출력하기 : 가!나!다!라 출력 / sep 인자 값들 사이에 공백대신 ! 출력
print("가", "나", "다", "라", sep="!")
300x250
공백 없이 데이터 출력하기  : HelloWorld 출력 / + 기호로 문자열의 공백없이 연결
print("Hello"+"World")

 

문자열 마지막 data를 추가하여 출력 : Hello^^World^^ 출력 / end 로 마지막 문자열을 출력
print("Hello", end="^^"); print("World", end="^^") 

 

이스케이프(Escape character) 문자 출력 : \,  ,  출력/  \t = 탭, \n = 공백
print("\", \t, \n")

 

 

2018.12.29 - [Programming Study] - JAVA 클래스 멤버변수 초기화

 

JAVA 클래스 멤버변수 초기화

※ 클래스 멤버변수 초기화 방법 3가지 소개 1. 명시적 초기화(Explicit initialization) 1 2 3 4 class Car {     int door = 4;     Engine e = new Engine(); } cs 2. 생성자(Constructor) 1..

jyj1118.tistory.com

2018.12.29 - [Programming Study] - JAVA String↔Int 변환 & String split (파싱/나누기/자르기)

 

JAVA String↔Int 변환 & String split (파싱/나누기/자르기)

JAVA String 관련 함수 정리 * String을 int로 변환 1 2 String strs = "123"; int num = Integer.parseInt(strs);    cs * Int를 string으로 변환 1 2 int num = 123; string str = Interger.toString(r..

jyj1118.tistory.com

 

728x90
300x250