본문 바로가기

반응형

python

python 모듈 탐색 경로 찾기 python 모듈 탐색 경로 찾기 테스트 환경 $ python --version Python 3.9.13 파이션 3.9의 sys.path 값 - 임포트할 모듈 경로 python import sys for place in sys.path: print(place) $ python Python 3.9.13 (main, Aug 7 2022, 01:19:39) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> for place in sys.path: ... print(place) ... /opt/homebrew/Cella.. 더보기
[리눅스] fabric 라이브러리 설치 fabric 라이브러리 설치 설치 환경 $ cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) fabric 설치 yum install -y epel-release yum install -y python3-devel python3-pip python3-setuptools python3 --version $ python3 --version Python 3.6.8 pip3 install fabric fab --version $ fab --version Fabric 2.5.0 Paramiko 2.7.2 Invoke 1.5.0 더보기
AWS CloudWatch 경보를 Slack으로 보내는 방법 AWS CloudWatch 경보를 Slack으로 보내는 방법 CloudWatch 경보가 발생하면 Lambda 함수가 실행되어 Slack으로 메시지를 전송합니다. 시스템 구성 1. Amazon SNS 1-1. 주제 생성 이름 : cloudwatch-notification 1-2 구독 메일 확인 1-3 메시지 게시(메시지 발송 테스트) 메일 확인 2. Slack Webhook URL 생성 Slack 워크스페이스에서 Incoming Webhooks을 활성화하고 Webhook URL을 생성합니다. slack webhooks(incoming webhooks) 생성 방법 https://sangchul.kr/784 #cluodwatchalert https://hooks.slack.com/services/T018562.. 더보기
[url] Python PyCharm PyCharm(python 프로그램) https://www.python.org/downloads/release https://www.jetbrains.com/pycharm/download/#section=windows 더보기
파이션 파일 및 디렉토리 작업 Python에서 파일 및 디렉토리 작업을 수행하기 위해 os 모듈과 shutil 모듈을 주로 사용합니다. 아래에 간단한 예시를 제공하겠습니다.파일 작업1. 파일 생성>>> with open("example.txt", "w") as file:... file.write("Hello, world!")... 13root@node3:Learn_Python$ ls -ltotal 4-rw-r--r-- 1 root root 13 Feb 29 10:56 example.txt2. 파일 읽기>>> with open("example.txt", "r") as file:... contents = file.read()... print(contents)... Hello, world!3. 파일 쓰기>>> with.. 더보기
파이션 기본 문법 및 데이터 타입 이해 파이썬의 기본 문법과 데이터 타입을 이해하는 것은 파이썬 프로그래밍을 시작하는 데 중요한 단계입니다. 아래에서는 파이썬의 기본 문법과 주요 데이터 타입을 간단히 설명하겠습니다.기본 문법1. 주석 (Comments)# 기호로 시작하여 한 줄 주석을 작성할 수 있습니다.# 이것은 주석입니다2. 변수 (Variables)변수는 값을 저장하는 데 사용되며 자료형을 지정하지 않아도 됩니다.x = 10name = "John"3. 조건문 (Conditional Statements)if, elif, else 키워드를 사용하여 조건문을 작성합니다.if x > 10: print("x는 10보다 큽니다")elif x == 10: print("x는 10입니다")else: print("x는 10보다 작습니다").. 더보기

728x90
반응형