파이썬
<파이썬 기초> import sys ? 왜 사용할까? 기본적인 파이썬 모듈
LEEHANDS
2021. 4. 17. 21:03
반응형
1. import sys
sys - System specific parameters and functions
this module privides access to some variable used or maintained by the interpreter to functions that interract strongly with the interpreter. It is always available.
영문 내용으로보면 그냥 무조건 써야할 것같은 생각이 듭니다.
다시 설명하자면, 파이썬 인터프리터 를 제어할 수 있는 방법을 제공
2. Import os
OS를 제어할 수 있는 방법을 제공
import os
os.getcwd()
3. Import re
Regular expression 을 이용해 문자열을 다룰 수 있는 re 모듈
import re, glob
p = re.compile('.*p.*n.*')
for i in glob.glob('*'):
m = p.match(i)
if m:
print m.group()
4. Import webbrowser
>>> import webbrowser
>>> url = 'http://www.python.org/'
>>> webbrowser.open(url)
True
반응형