陳子傑
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    2
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Windows環境,自動化腳本執行Python檔案 >[!Warning] >這份教學僅限用於windows系統下,其他作業系統的使用者,抱歉了! ## 前言 是否曾經遇到過以下情況: - 你寫了一個功能完善的 Python 程式,==**但希望它能夠自動每隔一段時間運行**==,而不必每次都手動啟動? - 你正在編寫一個網絡爬蟲,==**需要每天獲取最新數據,但每次都需要手動運行程式**==,甚至為了做到每日更新,還要設鬧鐘(or行事曆)來提醒自己要執行程式? - ==**你曾經為了實現自動化而花費了金錢購買第三方工具**==,但仍然希望能找到一種更靈活且經濟的自動化方案? 如果你也遇到過這些挑戰,那麼你來對地方了! ## 自動化執行--前言 這次教學會用到一些工具跟概念 >[!Note] > **BAT 檔案(批處理檔案)是一種腳本文件**,主要用於在 Microsoft Windows 操作系統中自動執行一系列命令。 >[!Note] > **工作排程器(Task Scheduler)是一種操作系統工具**,用於在預定時間或特定條件下自動執行程序或腳本。 > Windows 工作排程器是一個內建的工具,用於在 Windows 系統中設定和管理排程任務。它允許用戶定義何時執行某些程序或腳本,並提供了多種觸發條件和執行選項。 ## 實際操作一次 >[!Tip] >這份教學會用到 Colab 檔案 [testing_python_with_auto_execute](https://colab.research.google.com/drive/13fOS-lD5xOCJNnEMI9sONdheHD2Nao3-) >此python執行功能: >>當沒有文件的時候,建立一個新的文件.txt檔案 >>如果檔案存在,就在文件裡寫"執行時間"到.txt檔案當中 ### 1. 點擊上方連結進到colab,並且選擇下載檔案 ![image](https://hackmd.io/_uploads/H1nbdGNT0.png) ### 2. 將其檔案放在自己想要放的地方(本文範例是將其放在桌面上自己創建的一個文件夾當中,如下所演示) ![image](https://hackmd.io/_uploads/BJcA_GVaR.png) ![image](https://hackmd.io/_uploads/B1RktMV6C.png) >[!Warning] >檔案位置非常重要,之後建立腳本檔案的時候會用到 >[!Warning] >檔案夾盡量不要打中文字,有時候讀取會出現錯誤 ### 3. 下載Python安裝包,這樣電腦才能跑動.py檔案 ![image](https://hackmd.io/_uploads/HyYQoMV60.png) ### 4.自動化腳本編寫 - 先建立一個.txt檔案 - 在.txt檔案中寫入兩行程式 ``` cd 剛剛建立的檔案夾位置 python 檔案名稱.py ``` 以我為例: ![image](https://hackmd.io/_uploads/rJ5E9fV6A.png) 那我會在我的.txt檔案中寫到: ``` cd C:\Users\user\Desktop\自動化 python testing_python_with_auto_execute.py ``` - 將其.txt檔案轉成.bat檔案(轉成腳本檔案) ![image](https://hackmd.io/_uploads/SJ_GjzVaR.png) 當你完成以上任務後,可以點擊.bat看看,如果點擊完後,python如果有創立一個.txt檔案的話,那就是成功了! ### 5.讓電腦自動去跑動.bat檔案 - 打開**工作排程器**(通常windows有內建此功能) >[!Warning]如果你找不到 >按下 Windows 鍵 + R,輸入`taskschd.msc`,然後按下 Enter 鍵。 - 點擊"建立工作" ![image](https://hackmd.io/_uploads/HyN_szNTR.png) - 輸入工作名稱(隨便取就好) - 點擊觸發程序,編寫觸發條件(我們設定"每五分鐘就驅動一次") ![image](https://hackmd.io/_uploads/BJd6jG4pR.png) - 點擊動作,並將剛剛的.bat檔案加到裡面 ![image](https://hackmd.io/_uploads/HJExnzVT0.png) - 按下確定之後,就大功告成啦!! - 接下來,你可以去看"工作排程器程式庫",就能看到我們新增的指令了! ![image](https://hackmd.io/_uploads/H1lDhzEpC.png) ## 影片教學版 如果文字看得不夠清楚,可以跟著下方的影片一起做一遍,約5分鐘就能設置完成 {%youtube q8F4yLrZrEA %}

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully