728x90

👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
print("print("what to print")")
 
 
 

 

 

🖨️오류

SyntaxError: invalid syntax

 

 

📡 원인

문자열 선언 시, 문법적 오류 발생

"print("와 ")"만 문자열로 인식되면서, what to print 부분이 프로그램언어로 인식되어 발생

 

 

📰 해결 방법

1
2
3
print("print('what to print')")
print('print("what to print")')
 
 
 
"" 또는 ''을 출력하고 싶을 경우, 내부와 외부 문자열 선언 기호를 ""/''로 구분해서 사용
 
728x90
728x90

👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
print("Hello World!)
 
 

 

 

🖨️오류

SyntaxError: EOL(End of Life) while scanning string literal

 

 

📡 원인

문자열 선언 시, 문법적 오류 발생

""가 맞지 않거나 문장부호(){}[]의 열림 닫힘이 맞지 않을 때 발생

 

 

📰 해결 방법

1
2
print("Hello World!")
 
 

""를 짝에 맞춰 수정

 

 

728x90