강의

멘토링

커뮤니티

Inflearn Community Q&A

icedratini0931's profile image
icedratini0931

asked

Getting Started with Programming: Introduction to Python (Inflearn Original)

Character type (2-2)

multi line 예제파일에서

Written on

·

210

0

multi_str2 = \

    '''

    문자열 멀티라인

    역슬래시(\) \

    테스트

    '''

print(multi_str2)

출력하면 4번째 줄의 마지막 \가 무슨 역할을 하길래

    문자열 멀티라인
    역슬래시(\)     테스트

이렇게 출력되는건가요?

python

Answer 2

0

icedratini0931님의 프로필 이미지
icedratini0931
Questioner

출력 된 결과를 보면 한줄로 나오긴 했는데, 역슬래시(\) 와 테스트 사이의 간격은 왜 넓은건가요? 마치 \t 같은 느낌으로 간격이 넓게 붙어 있길래요.

0

niceman님의 프로필 이미지
niceman
Instructor

안녕하세요. DYR.P 님

\ 멀티라인으로 원래 한 줄에 코드를 써서 표현하는 것을 다음라인으로 연속에서 작성할 때 

사용합니다.

In Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return. Conversely, prefixing a special character with "\" turns it into an ordinary character.

icedratini0931's profile image
icedratini0931

asked

Ask a question