콘텐츠로 건너뛰기
  • 카테고리
  • 최근
  • 태그
  • 인기
  • 사용자
  • 그룹
스킨
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 기본 (Cosmo)
  • 스킨 없음
축소

책공장

  1. 홈
  2. wiki
  3. 출판 소식
  4. 일상 업무를 자동화하는 최고의 25개 Python 스크립트
AI시대 출판사, 창작자는 무엇을 해야할지 홍보는 어떻게 하는건지 네이버, 카카오톡, 구글 계정으로 로그인 가능

일상 업무를 자동화하는 최고의 25개 Python 스크립트

예약됨 고정됨 잠김 이동됨 출판 소식
1 게시물 1 작성자 30 조회수
  • 오래된 순
  • 최신 순
  • 가장 많은 투표
답글
  • 토픽으로 답글
로그인 후 답글 작성
이 토픽은 삭제되었습니다. 토픽 관리 권한이 있는 사용자만 볼 수 있습니다.
  • adminA 오프라인
    adminA 오프라인
    admin
    에 작성함 마지막 수정자: admin
    #1

    Python은 단순성과 광범위한 라이브러리 덕분에 일상적인 작업을 자동화하는 데 탁월한 도구입니다. 아래는 다양한 도메인에서 일반적인 작업을 자동화하는 데 도움이 되는 상위 25개 Python 스크립트입니다.

    1. 이메일 전송 자동화
      Use Python to send emails with attachments.
      Libraries: smtplib, email
    import smtplib
    from email.mime.text import MIMEText
    
    def send_email(subject, body, to_email):
        smtp_server = "smtp.gmail.com"
        smtp_port = 587
        sender_email = "your_email@gmail.com"
        sender_password = "your_password"
    
        msg = MIMEText(body)
        msg['Subject'] = subject
        msg['From'] = sender_email
        msg['To'] = to_email
    
        with smtplib.SMTP(smtp_server, smtp_port) as server:
            server.starttls()
            server.login(sender_email, sender_password)
            server.sendmail(sender_email, to_email, msg.as_string())
    
    1. 데이터 추출을 위한 웹 스크래핑
      웹사이트에서 데이터 추출을 자동화합니다.
      Libraries: requests, BeautifulSoup
    import requests
    from bs4 import BeautifulSoup
    
    def scrape_weather():
        url = "https://weather.com"
        response = requests.get(url)
        soup = BeautifulSoup(response.text, 'html.parser')
        print(soup.title.string)
    3. 인터넷에서 파일 다운로드
    URL에서 파일 다운로드를 자동화합니다.
    Libraries: requests
    import requests
    
    def download_file(url, save_path):
        response = requests.get(url)
        with open(save_path, 'wb') as file:
            file.write(response.content)
    
    1. 파일 정렬 자동화
      자동으로 파일을 확장자별로 정리합니다.
      Libraries: os, shutil
    import os
    import shutil
    
    def sort_files(directory):
        for file in os.listdir(directory):
            ext = file.split('.')[-1]
            folder = os.path.join(directory, ext)
            os.makedirs(folder, exist_ok=True)
            shutil.move(os.path.join(directory, file), os.path.join(folder, file))
    
    1. 여러 파일 이름 바꾸기
      디렉토리의 파일 이름을 일괄적으로 바꿉니다.
      Libraries: os
    import os
    
    def rename_files(directory, prefix):
        for i, file in enumerate(os.listdir(directory)):
            os.rename(os.path.join(directory, file), os.path.join(directory, f"{prefix}_{i}.txt"))
    
    1. 백업 생성 자동화
      중요한 파일을 ZIP 파일로 백업하세요.
      Libraries: shutil
    import shutil
    
    def create_backup(source_dir, backup_file):
        shutil.make_archive(backup_file, 'zip', source_dir)
    
    1. 소셜 미디어 게시물 자동화
      트윗/게시물 예약하기.
      Libraries: tweepy, facebook-sdk
    import tweepy
    
    def post_tweet(api_key, api_secret, access_token, access_secret, tweet):
        auth = tweepy.OAuthHandler(api_key, api_secret)
        auth.set_access_token(access_token, access_secret)
        api = tweepy.API(auth)
        api.update_status(tweet)
    
    1. 스프레드시트 데이터 자동화
      Excel 파일을 읽고 씁니다.
      Libraries: openpyxl
    import openpyxl
    
    def read_excel(file):
        wb = openpyxl.load_workbook(file)
        sheet = wb.active
        for row in sheet.iter_rows():
            print([cell.value for cell in row])
    
    1. 텍스트 번역 자동화
      API를 사용하여 텍스트를 번역합니다.
      Libraries: googletrans
    from googletrans import Translator
    
    def translate_text(text, dest_lang):
        translator = Translator()
        return translator.translate(text, dest=dest_lang).text
    
    1. PDF 조작 자동화
      PDF에서 텍스트를 병합, 분할 또는 추출합니다.
      Libraries: PyPDF2
    from PyPDF2 import PdfReader, PdfMerger
    
    def merge_pdfs(pdf_list, output):
        merger = PdfMerger()
        for pdf in pdf_list:
            merger.append(pdf)
        merger.write(output)
    
    1. 이미지 처리 자동화
      크기를 조정하고 회전하거나 워터마크를 추가합니다.
      Libraries: Pillow
    from PIL import Image
    
    def resize_image(image_path, output_path, size):
        with Image.open(image_path) as img:
            img.resize(size).save(output_path)
    
    1. 웹사이트 모니터링 자동화
      웹사이트가 업데이트되면 알림을 받습니다.
      Libraries: requests, time
    import requests
    import time
    
    def monitor_website(url, interval):
        prev_content = None
        while True:
            response = requests.get(url)
            if response.text != prev_content:
                print("Website updated!")
                prev_content = response.text
            time.sleep(interval)
    
    1. 데이터베이스 백업 자동화
      MySQL과 같은 백업 데이터베이스.
      Libraries: subprocess
    import subprocess
    
    def backup_mysql(user, password, db_name, output):
        cmd = f"mysqldump -u {user} -p{password} {db_name} > {output}"
        subprocess.run(cmd, shell=True)
    14. Slack 알림 자동화
    Slack 메시지를 프로그래밍 방식으로 보냅니다.
    Libraries: slack-sdk
    from slack_sdk import WebClient
    
    def send_slack_message(token, channel, text):
        client = WebClient(token=token)
        client.chat_postMessage(channel=channel, text=text)
    
    1. 날씨 업데이트 자동화
      날씨 데이터를 가져옵니다.
      Libraries: requests
    import requests
    
    def get_weather(api_key, city):
        url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}"
        return requests.get(url).json()
    

    16.텍스트 음성 변환 자동화
    Libraries: pyttsx3

    import pyttsx3
    
    def text_to_speech(text):
        engine = pyttsx3.init()
        engine.say(text)
        engine.runAndWait()
    
    1. 통화 변환 자동화
      API를 사용하여 통화를 변환하세요.
      Libraries: forex-python
    from forex_python.converter import CurrencyRates
    
    def convert_currency(amount, from_currency, to_currency):
        c = CurrencyRates()
        return c.convert(from_currency, to_currency, amount)
    
    1. 작업 일정 자동화
      Python 작업을 예약합니다.
      Libraries: schedule
    import schedule
    import time
    
    def task():
        print("Task running!")
    
    schedule.every().day.at("10:00").do(task)
    
    while True:
        schedule.run_pending()
        time.sleep(1)
    
    1. 알림 자동
      휴대폰으로 푸시 알림을 받으세요.
      Libraries: pushbullet
    [from pushbullet import Pushbullet
    
    def send_notification(api_key, title, body):
        pb = Pushbullet(api_key)
        pb.push_note(title, body)](link url)
    
    1. 디렉토리 정리 자동화
      디렉토리에서 오래된 파일을 삭제합니다.
      Libraries: os, time
    import os
    import time
    
    def cleanup(directory, days):
        now = time.time()
        for file in os.listdir(directory):
            filepath = os.path.join(directory, file)
            if os.stat(filepath).st_mtime < now - days * 86400:
                os.remove(filepath)
    
    1. 주가 모니터링 자동화
      주식 가격을 가져옵니다.
      Libraries: yfinance
    import yfinance as yf
    
    def get_stock_price(ticker):
        stock = yf.Ticker(ticker)
        return stock.history(period="1d")["Close"]
    
    1. QR 코드 생성 자동화
      텍스트나 URL에 대한 QR 코드를 생성합니다.
      Libraries: qrcode
    import qrcode
    
    def generate_qr(data, filename):
        qr = qrcode.make(data)
        qr.save(filename)
    
    1. 키 입력 시뮬레이션 자동화
      키보드 입력을 자동화합니다.
      Libraries: pyautogui
    import pyautogui
    
    def automate_typing(text):
        pyautogui.typewrite(text)
    
    1. Git 작업 자동화
      git push/pull을 자동화합니다.
      Libraries: subprocess
    import subprocess
    
    def git_push(message):
        subprocess.run(["git", "add", "."])
        subprocess.run(["git", "commit", "-m", message])
        subprocess.run(["git", "push"])
    
    1. 시간 추적 자동화
      업무에 소요된 시간을 추적하세요.
      Libraries: time
    import time
    
    start_time = time.time()
    # Do some work
    print("Time spent:", time.time() - start_time)
    These scripts can help you save time and simplify repetitive tasks. Combine these with cron jobs or task schedulers to unlock powerful automations!
    
    1 답글 마지막 답글
    0
    • 에 adminA admin님이 자유게시판에서 이 토픽을 이동함
    • 에 adminA admin님이 에서 이 토픽을 이동함
    • 에 adminA admin님이 책소개에서 이 토픽을 이동함
    답글
    • 토픽으로 답글
    로그인 후 답글 작성
    • 오래된 순
    • 최신 순
    • 가장 많은 투표


    0

    온라인

    135

    사용자

    28.9k

    토픽

    35.3k

    게시물
    • 새로 만든 카드뉴스- 책에 입히는 속옷 셰일라
      undefined
      0
      1
      16
    Powered by Argo9 | a1bbs |naver | Contributors
    • 로그인

    • 계정이 없으신가요? 등록

    • 검색하려면 로그인하거나 등록하세요.
    • 첫 게시물
      마지막 게시물
    0
    • 카테고리
    • 최근
    • 태그
    • 인기
    • 사용자
    • 그룹
    $(document).ready(function () { app.coldLoad(); }); }