python 썸네일형 리스트형 [python] 파이썬 로또 번호 생성기 파이썬 로또 번호 생성기lotto_v1.py 생성import random### 로또 번호 생성def lotto_numbers(): numbers = random.sample(range(1, 46), 6) numbers.sort() print(numbers)### 로또 시행 횟수def lotto_count(): count = int(input("시행 횟수 : ")) prin.. 더보기 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.. 더보기 CentOS 8에서 Fabric 라이브러리를 설치하는 방법 CentOS 8에서 Fabric 라이브러리를 설치하는 방법Fabric은 Python 기반의 원격 서버 자동화 도구입니다.SSH를 통해 여러 서버에 접속하여 명령 실행, 배포, 파일 전송, 운영 자동화 작업을 손쉽게 처리할 수 있습니다. Ansible처럼 대규모 구성 관리 도구보다는 가볍고 Python 코드로 직접 제어할 수 있어 운영 스크립트 자동화에 많이 사용됩니다.테스트 환경운영체제 정보$ cat /etc/redhat-releaseCentOS Linux release 8.1.1911 (Core)Fabric 설치CentOS 8 기본 저장소에는 최신 Python 패키지가 부족할 수 있으므로 EPEL Repository를 먼저 활성화합니다.yum install -y epel-releasePython 개발 .. 더보기 AWS CloudWatch 경보를 Slack으로 보내는 방법 AWS CloudWatch 경보를 Slack으로 보내는 방법CloudWatch 경보가 발생하면 Lambda 함수가 실행되어 Slack으로 메시지를 전송합니다.시스템 구성1. Amazon SNS1-1. 주제 생성이름 : cloudwatch-notification1-2 구독메일 확인1-3 메시지 게시(메시지 발송 테스트)메일 확인2. Slack Webhook URL 생성Slack 워크스페이스에서 Incoming Webhooks을 활성화하고 Webhook URL을 생성합니다.slack webhooks(incoming webhooks) 생성 방법https://sangchul.kr/784#cluodwatchalerthttps://hooks.slack.com/services/T018562TM6A/T017ZZ55YU.. 더보기 [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보다 작습니다").. 더보기 이전 1 ··· 4 5 6 7 다음