반응형

 

문자를 출력하다 보면 큰따옴표, 따옴표 출력이 필요할 때가 있습니다.

 

print로 간단하게 출력하는 방법을 보여드리겠습니다.

 

따옴표 및 큰따옴표 출력하기

 

왼쪽) 입력 / 오른쪽) 출력

a = "This is the python code."
#출력 : This is the python code.
b = "This is the 'python' code."
#출력 : This is the 'python' code.
c = 'This is the "python" code.'
#출력 : This is the "python" code.
d = '''This is the 'python' code.'''
#출력 : This is the 'python' code.
e = '''This is the "python" code.'''
#출력 : This is the "python" code.
f = """This is the 'python' code."""
#출력 : This is the 'python' code.
g = """This is the "python" code."""
#출력 : This is the "python" code.

 

큰따옴표로 전체를 묶고 안에 따옴표를 이용해 출력할 수 있으며, 반대로 따옴표로 전체를 묶고 안에 큰따옴표를 이용해서 출력할 수도 있습니다.

 

반응형

 

여러 줄 출력하기

 

왼쪽) 입력 / 오른쪽) 출력

h = "This is \
the python \
code."
# 출력 : This is the python code.

i = '''This is
the 'python'
code.'''
#출력 : This is
#       the 'python'
#       code.

 

역슬러쉬를 이용해서 문장이 이어지도록 연결할 수 있으며, 따옴표 3개를 이용해 여러 줄을 한꺼번에 연결해서 출력할 수도 있다.

 

반응형
반응형
반응형

기존 파이썬을 이용하면 라이브러리를 하나하나 설치해야 하지만

아나콘다를 통해서 여러 패키지(NumPy, SymPy, Matplotlib, 등)를 포함하여 제공한다. 

 

https://www.anaconda.com/

 

Anaconda | The World's Most Popular Data Science Platform

Anaconda is the birthplace of Python data science. We are a movement of data scientists, data-driven enterprises, and open source communities.

www.anaconda.com

 

아나콘다 홈페이지

 

설치 과정

 

 

 

Jupyter Notebook

 

 

Anaconda Prompt

 

python --version

Spyder

 

반응형
반응형
반응형

대문자 나 소문자 알파벳 리스트가 필요할때 일일이 노가다로 넣을수도 있지만 편리한 함수가 있다.

 

준비 : string 패키지를 import 해줘야 한다.

 

대,소문자 출력

 

string.ascii_lowercase : 소문자 + 대문자 순으로 출력한다

string.ascii_uppercase : 대문자 출력

string.ascii_lowercase : 소문자 출력

 

 

 

배열로 입력

 

※ 변수 = list(string.ascii_lowercase)

리스트로 변수에 간단히 입력해도 된다.

반응형

+ Recent posts