본문으로 바로가기

사회적 거리두는 블로그

현재위치 :: HOME BLOG CATEGORY SEARCH ARCHIVE TAGS MEDIA LOCATION GUESTBOOK

네비게이션

    관리자
    • 블로그 이미지
      JohnWick99

      프로그래밍, 꿀팁 정보를 알려드립니다.

      링크추가
    • 글쓰기
    • 환경설정
    • 로그인
    • 로그아웃

    파이썬 win32gui 모듈 다루기 - 현재 창 이름 구하기

    win32gui 모듈 설치 pip install pypiwin32 >>> import win32gui Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'win32gui' (py36) PS C:\Users\Desktop\python_> pip install pypiwin32 Requirement already satisfied: pypiwin32 in c:\programdata\anaconda3\envs\py36\lib\site-packages (223) Collecting pywin32>=223 Downloading pywin32-228-cp36-cp36m-win_amd64.whl (9.1..

    Language/Python 2020. 6. 30. 12:48

    파이썬 클립보드(clipboard) 모듈 다루기

    모듈 설치 pip install clipboard >>> import clipboard Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'clipboard' >>> (py36) PS C:\Users\Desktop\python_> pip install clipboard Processing c:\users\appdata\local\pip\cache\wheels\1e\86\2a\3612bf2a0fd7c563462ad5c3403683b55b68a8c36e47bc2648\clipboard-0.0.4-py3-none-any.whl Requirement already satisfied: pypercli..

    Language/Python 2020. 6. 30. 11:45

    파이썬 OS 모듈 - 파일 삭제, 디렉터리 삭제 os.remove os.rmdir shutil.rmtree

    파일 삭제 os.remove() 파일을 삭제할 때는 os.remove() 를 사용합니다. os.splitext() 를 이용하여 특정 확장자의 파일을 삭제할 수 있습니다. import os print('-'*70) file_list = os.listdir(dir_path) print(*file_list) print('-'*70) for file in file_list: name, ext = os.path.splitext(file) if ext == '.jpg': file_path = os.path.join(dir_path, file) print(file_path) os.remove(file_path) print('='*70) file_list = os.listdir(dir_path) print(*file_..

    Language/Python 2020. 6. 30. 10:51

    파이썬 OS 모듈 - 경로 분리, 확장자 분리 os.split os.splitext

    해당 경로의 디렉터리 경로 os.path.dirname(path) 해당 경로의 디렉터리 경로를 구합니다. print('dir') dir_path = os.getcwd() print(dir_path) dir_name = os.path.dirname(dir_path) print(dir_name) print('file') file_path = os.path.abspath(__file__) print(file_path) dir_name = os.path.dirname(file_path) print(dir_name) 더보기 dir C:\Users\Desktop\Reference\Example\ex_os C:\Users\Desktop\Reference\Example file c:\Users\Desktop\Refer..

    Language/Python 2020. 6. 26. 15:38

    파이썬 OS 모듈 - 경로 합치기, 디렉터리/파일 확인, 경로 존재 확인 os.join os.isdir os.exists

    경로 합치기 os.path.join(path1, path2, ...) 경로와 경로를 합치며 Windows(\), Linux(/) 에 모두 호환되므로, 경로를 합칠 때는 join() 을 쓰는 것을 추천합니다. path = os.getcwd() print(path) for file in os.listdir(): print(file) dir_name = 'test_dir' path2 = os.path.join(path, dir_name) print(path2) 더보기 C:\Users\Desktop\Reference\Example\ex_os ex1.py ex2.py test_dir C:\Users\Desktop\Reference\Example\ex_os\test_dir 디렉터리 확인 os.path.isdir(p..

    Language/Python 2020. 6. 26. 12:59

    파이썬 OS 모듈 - 현재 경로, 경로 변경, 디렉터리 검색 os.getcwd os.chdir os.listdir

    현재 경로 getcwd() / 경로 변경 chdir() getcwd() 은 파이썬을 실행한 현재 경로를 반환합니다. import os path = os.getcwd() print(path) os.chdir('test_dir') path = os.getcwd() print(path) 더보기 C:\Users\Desktop\Reference\Example\ex_os C:\Users\Desktop\Reference\Example\ex_os\test_dir 응용) 커맨드라인 구현 -1 cmd = { 'pwd': os.getcwd, 'cd': os.chdir } while True: ip = input('>> ') splt = ip.split(' ') if splt[0] not in cmd.keys(): print..

    Language/Python 2020. 6. 26. 10:43

    파이썬 랜덤 모듈 사용하기

    random() random()은 0과 1사이의 실수를 반환한다. (0 x in the interval [0, 1). [0] 0.5929115143771286 [1] 0.6740897798629769 [2] 0.7273050145961745 [3] 0.356795913096035 [4] 0.6579894236795625 [5] 0.1649985077423547 [6] 0.32859035067036346 [7] 0.9291320533374849 [8] 0.3958371558951975 [9] 0.17532426241025212 randint(a, b) randint()는 a와 b사이의 정수를 반환한다. (a

    Language/Python 2020. 6. 18. 21:40

    파이썬 자료형 타입 확인하기

    isinstance(object, class) 첫 번째 인자로 object 두 번째 인자로 class 명을 넣어서 확인할 수 있다. val1 = 1 print(type(val1)) if isinstance(val1, int) else print('no') val2 = 1.1 print(type(val2)) if isinstance(val2, float) else print('no') val3 = complex(1, 3) print(type(val3)) if isinstance(val3, complex) else print('no') val4 = 'string' print(type(val4)) if isinstance(val4, str) else print('no') val5 = [] print(type(..

    Language/Python 2020. 6. 18. 18:47
    • 이전
    • 1
    • ···
    • 4
    • 5
    • 6
    • 7
    • 8
    • 다음

    사이드바

    반응형

    CATEGORY

    • 분류 전체보기 (246)
      • Environment (3)
        • VSCode (1)
      • Linux(2020) (3)
      • API (14)
      • Crawling (11)
        • Basic (8)
        • Data (3)
      • Language (71)
        • Python (61)
        • Javascript (7)
        • Dart (3)
      • Application (35)
        • Flutter (11)
        • Flask (9)
        • PyQt5 (15)
      • AI (5)
        • ML (4)
      • IoT (24)
        • Raspberry Pi (24)
      • OpenCV (28)
      • Bot (8)
      • Errors (9)
      • Tools (3)
      • OS(~2018) (31)
        • Server (8)
        • Window (4)
        • Linux (16)
        • Tools (3)
    • 홈으로
    • 방명록
    • 로그인
    • 로그아웃
    • 맨위로
    SKIN BY COPYCATZ COPYRIGHT 사회적 거리두는 블로그, ALL RIGHT RESERVED.
    사회적 거리두는 블로그
    블로그 이미지 JohnWick99 님의 블로그
    MENU
      CATEGORY
      • 분류 전체보기 (246)
        • Environment (3)
          • VSCode (1)
        • Linux(2020) (3)
        • API (14)
        • Crawling (11)
          • Basic (8)
          • Data (3)
        • Language (71)
          • Python (61)
          • Javascript (7)
          • Dart (3)
        • Application (35)
          • Flutter (11)
          • Flask (9)
          • PyQt5 (15)
        • AI (5)
          • ML (4)
        • IoT (24)
          • Raspberry Pi (24)
        • OpenCV (28)
        • Bot (8)
        • Errors (9)
        • Tools (3)
        • OS(~2018) (31)
          • Server (8)
          • Window (4)
          • Linux (16)
          • Tools (3)
      VISITOR 오늘 / 전체
      • 글쓰기
      • 환경설정
      • 로그인
      • 로그아웃
      • 취소

      검색

      티스토리툴바