파이썬의 PRINT 함수

王林
풀어 주다: 2024-07-17 11:34:57
원래의
1102명이 탐색했습니다.

PRINT function in python

2024-07-13

PRINT() 함수

print() 함수는 화면에 출력해주는 함수입니다

print() 함수에는 세 가지 용도가 있습니다.

  1. 작은따옴표(' ')
  2. 큰따옴표(" ")
  3. 세 개의 따옴표(“”” “””)------------여러 줄의 경우

누구나 인용할 수 있지만 같은 줄에 다른 인용문은 사용할 수 없습니다

print()---------------------------#create empty line
로그인 후 복사
print("jothilingam")--------------#string should print with""
로그인 후 복사
print(5)------------------------#number can print without ""
로그인 후 복사
print("jo""jo")--------------print without space
print("jo"+"jo")--------------print without space
answer    jojo
print("jo","jo")--------------print with space
answer     jo jo
로그인 후 복사

f-문자열로 인쇄

name = "jothi"
print(f"Hello {name}")
# Output : Hello jothi
로그인 후 복사

줄 바꿈 이스케이프 문자 n

print("jo\nthi")
jo
thi
로그인 후 복사

print() 함수의 매개변수:

sep매개변수

print("jo","jo",sep="_")...................sep="" is default
answer    jo_jo
로그인 후 복사
print("jo", "lingam", sep='thi')
answer     jothilingam
로그인 후 복사

최종 매개변수

print("jothi",end="lingam")
answer  jothilingam
로그인 후 복사
print("jothi",end="")----------------without space
print("lingam")
answer  jothilingam
로그인 후 복사
print("jothi",end=" ")----------------with space
print("lingam")
answer  jothi lingam
로그인 후 복사

* 매개변수

print(*"jothilingam")
answer    j o t h i l i n g a m
로그인 후 복사

file및flush매개변수. 이러한 매개변수는 파일을 처리할 수 있는 매개변수이기 때문입니다

위 내용은 파이썬의 PRINT 함수의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:dev.to
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!