본문으로 바로가기

사회적 거리두는 블로그

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

네비게이션

    관리자
    • 블로그 이미지
      JohnWick99

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

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

    파이썬 psutil 모듈 사용하기 -1 : CPU, 메모리 정보 구하기

    psutil documentation — psutil 5.7.2 documentation psutil documentation About psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. It is useful mainly for system moni psutil.readthedocs.io 모듈 소개 psutil은 파이썬을 위한 실행중인 프로세스 및 시스템 리소스 및 정보 검색을 위한 크로스 플랫폼 라이브러리입니..

    Language/Python 2020. 7. 16. 14:22

    파이썬 XML Pretty 출력하기

    예제 xml.dom.minidom 은 xml 객체, xml 파일에서 dom 객체를 변환하기 위해 사용되는 모듈입니다. import xml.dom.minidom src_xml = 'jvvp.tistory.com' xml = xml.dom.minidom.parseString(src_xml) pretty_xml = xml.toprettyxml() print(src_xml) print(pretty_xml) 더보기 jvvp.tistory.com jvvp.tistory.com 파일에도 쓰고 읽어 봅니다. import xml.dom.minidom src_xml = 'jvvp.tistory.com' xml = xml.dom.minidom.parseString(src_xml) pretty_xml = xml.toprett..

    Language/Python 2020. 7. 15. 14:52

    파이썬 pickle 모듈 다루기 - 객체 저장

    파이썬 객체 파일로 쓰고 읽기 파이썬의 객체를 저장할 때는 pickle 모듈을 사용합니다. wb 바이너리 파일로 쓰기. import pickle colors = {'red': 1, 'green': 0, 'blue': 3} with open('colors.pkl', 'wb') as f: pickle.dump(colors, f) 그냥 텍스트 파일처럼 읽으려고 하면 글자가 깨져서 보입니다. (바이너리 파일) (py36) PS C:\Users\Desktop\Python\pickle> cat colors.pkl ╚}q (X╚ redq╔K╔X║ greenq╗K X╝ blueq╚K╚u. rb 바이너리 파일 읽기. import pickle with open('colors.pkl', 'rb') as f: colors =..

    Language/Python 2020. 7. 13. 20:15

    파이썬 문자함수 알아보기

    숫자 구분하기 가장 범위가 가장 큰 것부터 나열하면 isnumeric() > isdigit() > isdecimal() 아래 예제를 비교해봅니다. num = '1' num2 = '1.1' num3 = '3²' num4 = '½' num5 = '4.24e-10' print(f'{num}: ', num.isdecimal(), num.isdigit(), num.isnumeric()) print(f'{num2}:', num2.isdecimal(), num2.isdigit(), num2.isnumeric()) print(f'{num3}: ', num3.isdecimal(), num3.isdigit(), num3.isnumeric()) print(f'{num4}: ', num4.isdecimal(), num4.is..

    Language/Python 2020. 7. 13. 19:51

    파이썬 split, join 사용하기 - 전처리

    문자열을 분할하기 기본적으로 문자열을 리스트로 만들면 다음과 같습니다. >>> string = 'Duis varius, ligula molestie dapibus sodales, ipsum nunc venenatis sapien, at placerat eros felis sit amet nulla.' >>> list(string) ['D', 'u', 'i', 's', ' ', 'v', 'a', 'r', 'i', 'u', 's', ',', ' ', 'l', 'i', 'g', 'u', 'l', 'a', ' ', 'm', 'o', 'l', 'e', 's', 't', 'i', 'e', ' ', 'd', 'a', 'p', 'i', 'b', 'u', 's', ' ', 's', 'o', 'd', 'a', 'l', '..

    Language/Python 2020. 7. 13. 19:20

    파이썬 find, replace, strip 사용하기 - 전처리

    문자열 찾기 문자열을 찾을 때는 find() 함수를 사용합니다. text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' find = text.find('ipsum') find2 = text.find('pink') print(find) print(find2) if find > -1: print(f'found {find} index.') if find2 > -1: print(f'found {find2} index.') else: print('Not found') 더보기 6 -1 found 6 index. Not found. 리스트처럼 index() 도 사용가능합니다. 찾는 문자열이 존재 하지 않을 경우 에러를 발생합니다. text = 'Lorem..

    Language/Python 2020. 7. 13. 19:08

    파이썬 langdetect(언어감지) 모듈 소개

    langdetect Language detection library ported from Google's language-detection. pypi.org 모듈 설치 pip install langdetect py36) PS C:\Users\Desktop\langdetect_> pip install langdetect Requirement already satisfied: langdetect in c:\users\d-wook\.conda\envs\py36\lib\site-packages (1.0.8) Requirement already satisfied: six in c:\users\d-wook\.conda\envs\py36\lib\site-packages (from langdetect) (1.12.0)..

    Language/Python 2020. 7. 13. 18:32

    파이썬 print() 로 간단한 진행바 구현

    print() 기본적으로 print() 함수의 end 매개변수는 \n로 되있습니다. 여기에 \r 을 주게되면 커서가 앞으로 이동하게 됩니다. 이것을 이용하면 다음과 같이 간단하게 진행바를 구현할 수 있습니다. 임의의 작업을 나타내는 리스트를 생성하고, sleep() 함수를 이용해서 딜레이를 주었습니다. import time tasks = [i for i in range(100)] pg = 1 for task in task: time.sleep(1) print(f'progressbar : {pg}%', end='\r') pg += 1

    Language/Python 2020. 7. 11. 02:08
    • 이전
    • 1
    • 2
    • 3
    • 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 오늘 / 전체
      • 글쓰기
      • 환경설정
      • 로그인
      • 로그아웃
      • 취소

      검색

      티스토리툴바