반응형 Program54 텔레그램 Bot Token & chat ID 설정 방법 텔레그램 봇 토큰 & 챗 ID 설정 방법 (초보자용 완벽 가이드)텔레그램 봇을 사용하려면 아래 두 가지가 반드시 필요합니다.봇 토큰 (Bot Token) → 봇의 고유 인증키 (비밀번호 역할)챗 ID (Chat ID) → 메시지를 받을 대상 정보이 글에서는 초보자도 그대로 따라 하면 설정이 끝나도록 아주 쉽게 설명합니다.1. 텔레그램 봇 토큰(Token) 발급 방법BotFather로 봇 만들기텔레그램에서 BotFather를 검색해 접속합니다.👉 BotFather단계별 진행 방법① BotFather 시작채팅창에 아래 명령어 입력/start② 새 봇 생성/newbot입력③ 봇 이름 입력👉 사용자에게 보여지는 이름입니다.예시:My Test Bot④ 봇 아이디 입력 (중요)👉 반드시 bot으로 끝나야 합니.. 2026. 5. 2. Git 브랜치가 원격과 갈라졌을 때 해결 방법 # Git 브랜치가 원격과 갈라졌을 때 해결 방법 (`diverged` 상황)로컬에서 작업하다 보면 이런 메시지를 만날 수 있습니다:```On branch mainYour branch and 'origin/main' have diverged,and have 1 and 1 different commits each, respectively. (use "git pull" if you want to integrate the remote branch with yours)nothing to commit, working tree clean```이 말은 간단히 정리하면:* 내 로컬 `main` 브랜치에 커밋이 1개 있음* 원격 `origin/main` 브랜치에도 다른 커밋이 1개 있음* 즉, 두 브랜치가 서로 다른 .. 2025. 9. 4. 파이썬 Python 파일명 패턴이 숫자 또는 날짜 형식인 파일만 필터링 # 파일명 패턴이 숫자 또는 날짜 형식인 파일만 필터링 파일명이 `20240505_report.txt` 처럼 날짜/숫자 패턴을 포함할 경우 정규식을 사용할 수 있습니다. import osimport re folder_path = 'C:/Users/username/Documents/myfolder' pattern = re.compile(r'\d{8}_report\.txt') # 예: 20240505_report.txt matched_files = [f for f in os.listdir(folder_path) if pattern.match(f) and os.path.isfile(os.path.join(folder_path, f))] print(matched_files) 날짜 .. 2025. 5. 5. 파이썬 Python 파일 크기 + 확장자 복합 필터링 # 파일 크기 + 확장자 복합 필터링 파일 확장자와 크기 조건을 동시에 만족하는 파일만 가져오려면 아래처럼 조합할 수 있습니다. import os folder_path = 'C:/Users/username/Documents/myfolder' filtered_files = [f for f in os.listdir(folder_path) if f.endswith('.csv') and os.path.getsize(os.path.join(folder_path, f)) > 50000 and os.path.isfile(os.path.join(folder_path, f))] print(filtered_files) 예.. 2025. 5. 5. 파이썬 Python 특정 날짜 이후에 수정된 파일 가져오기 # 특정 날짜 이후에 수정된 파일 가져오기 수정일 기준으로 필터링할 때는 `datetime`과 `os.path.getmtime()`을 함께 사용합니다. import osimport datetime folder_path = 'C:/Users/username/Documents/myfolder'target_time = datetime.datetime(2024, 1, 1).timestamp() # 2024년 1월 1일 이후 recent_files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and os.path.getmtime(os.path.j.. 2025. 5. 5. 파이썬 Python pathlib로 특정 확장자만 필터링 # pathlib로 특정 확장자만 필터링 (.pdf 등) `pathlib`의 `.suffix`를 활용하면 특정 확장자만 걸러낼 수 있습니다. from pathlib import Path folder_path = Path('C:/Users/username/Documents/myfolder') pdf_files = [f for f in folder_path.iterdir() if f.is_file() and f.suffix == '.pdf'] print(pdf_files) 복수 확장자도 (f.suffix in ['.jpg', '.png']) 형태로 걸러낼 수 있어요. 2025. 5. 5. 이전 1 2 3 4 ··· 9 다음 반응형