터미널은 Command Line Interface (CLI)이다. GUI와는 반대 개념.
-
change directory 폴더 경로 이동
cd 경로 -
make directory 폴더 생성
mkdir 폴더명 -
terminal에서 python 실행
terminal에서 python3 입력하면 python과 상호작용하면서 작업을 할 수 있는 interactive shell이 실행된다.#!/usr/local/bin/python3
아래 명령어로 직접 경로를 알아내 적용할 수도 있지만 버전에 따라 달리해야 하기 때문에 범용성이 떨어짐
type python3-
apache가 동작하는 방식을 바꿀 때 사용하는 설정 파일
/conf/httpd.conf -
문자열 escape
print("Hell'o', \"W\"orld!")#출력값 Hell'o', "W"orld!
string은 작은 따옴표(”)를 더 많이 쓰지만 큰 따옴표(” “)로도 사용 가능한 이유는, 작은 따옴표 자체를 문자열로 출력하는 경우 때문이다.
-
줄바꿈
print('H\nello')# 출력값 H ello -
범위 내에 있는 모든 텍스트를 string으로 인식하게 하기
print(''' H e l l o ''')# 출력값 H e l l o -
이항 연산자 예시
print(1+1)# 출력값 2 -
비교연산자 (boolean 출력)
print(1==1) print(1<2) print(1>2)# 출력값 true true false -
특정단어가 존재하는지 검사 (boolean 출력)
print('world' in 'Hello world')# 출력값 true -
해당 파일이 있는지 검사
import os.path print(os.path.isfile('파일명'))또는
print(os.path.exists('파일명'))