"Python 문자열 여러 줄 입력"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
3번째 줄: 3번째 줄:
;Python 멀티라인 문자열
;Python 멀티라인 문자열


<source lang='python'>
<syntaxhighlight lang='python'>
s = '''Hello,
s = '''Hello,
How are you?'''
How are you?'''
9번째 줄: 9번째 줄:
# Hello,
# Hello,
# How are you?
# How are you?
</source>
</syntaxhighlight>
<source lang='python'>
<syntaxhighlight lang='python'>
s = '''Hi,
s = '''Hi,
What's up?'''
What's up?'''
16번째 줄: 16번째 줄:
# Hi,
# Hi,
# What's up?
# What's up?
</source>
</syntaxhighlight>
<source lang='python'>
<syntaxhighlight lang='python'>
s = """Hi,
s = """Hi,
What's up?"""
What's up?"""
23번째 줄: 23번째 줄:
# Hi,
# Hi,
# What's up?
# What's up?
</source>
</syntaxhighlight>
<source lang='python'>
<syntaxhighlight lang='python'>
print """Hello
print """Hello
My
My
Friend"""
Friend"""
</source>
</syntaxhighlight>
<source lang='python'>
<syntaxhighlight lang='python'>
print """\
print """\
Hello
Hello
My
My
Friend"""
Friend"""
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:31 판

1 개요

Python 문자열 여러 줄 입력
Python 멀티라인 문자열
s = '''Hello,
How are you?'''
print( s )
# Hello,
# How are you?
s = '''Hi,
What's up?'''
print( s )
# Hi,
# What's up?
s = """Hi,
What's up?"""
print( s )
# Hi,
# What's up?
print """Hello
My
Friend"""
print """\
Hello
My
Friend"""

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}