William Huang (黃威穎)
    • 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

      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.
      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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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

    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.
    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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Python :::spoiler {state="open"} **🧷 Table of Content** <br/> - __Root:__ **[Web Development](/Kt7xgfDNQJq12DduZa0nfw)** - __Programming Language__ [toc] ::: <br/> ## 1. Introduction - **Purpose**: Python is a general-purpose programming language widely used in web development, data analysis, machine learning, game development, scripting, automation, and more. - **Features**: - Simple and readable syntax that facilitates fast development and maintenance. - Comes with a powerful standard library supporting a wide range of common tasks. - Has a vast third-party package ecosystem (e.g., `PyPI`) to extend functionality. - High-level language that supports multiple programming paradigms (object-oriented, functional, procedural). - ==Basic Syntax==: 1. ++Variables and data types++: (`int`, `float`, `str`, `list`, `dict`, `tuple`, `set`) 2. ++Control flow++: (`if`, `for`, `while`) 3. ++Function definition++: `def`, arguments, return values 4. ++Modules and imports++ (`import`) 5. ++Exception handling++ (`try` / `except`) 6. ++List comprehensions & lambda expressions++ 7. ++Object-Oriented Programming++ (`class`, `method`, `self`) - ==Built-in Data Structures==: - `list` → ordered, mutable - `tuple` → ordered, immutable - `set` → unordered, unique elements - `dict` → key-value pairs - `heapq` → priority queues (min-heap) - `deque` → from `collections`, fast append/pop from both ends - other `collections` → `Counter`, `defaultdict`, `OrderedDict` - ==Important Libraries==: - _Data Processing & Analysis_ : 1. `NumPy`: Efficient numerical computation and array operations 2. `Pandas`: Data manipulation and tabular data (DataFrame) - _Data Visualization_ : 1. `Matplotlib`: Basic plotting and charting 2. `Seaborn`: Statistical data visualization built on top of Matplotlib 3. `Plotly`: Interactive charts and dashboards - _Automation & Web Scraping_ : 1. `Requests`: HTTP client for web requests 2. `BeautifulSoup` / `lxml`: HTML parsing 3. `Selenium`: Browser automation - _Development & Testing Tools_ : 1. `unittest` / `pytest`: Testing frameworks 2. `virtualenv` / `pipenv`: Virtual environments and dependency management <br/> ## 2. Functions and Tools - **Anonymous Functions**: `lambda` - Define small, unnamed functions: `lambda args: expression` - Commonly used in `map()`, `filter()`, `sorted(key=...)`, etc. - **Map, Filter, and Zip**: - `map(func, iterable)`: Applies a function to each item in the iterable. - `filter(func, iterable)`: Filters items based on a boolean function. - `zip(iter1, iter2)`: Combines multiple iterables into tuples. - ==`functools` _[🔗](/Sy8SFs1lxe)_== : - **Reduction**: `functools.reduce`: - `reduce(function, iterable, initializer?)` - Reduces an iterable to a single value using a function. - **Partial Functions**: `functools.partial` - Fixes some arguments of a function and returns a new function. - **Memoization**: `functools.lru_cache` - Caches results of expensive function calls. - Simply add a __decorator__ to enable. - **`Itertools`**: A module provides advanced iteration utilities: - `itertools.chain(*iterables)`: Concatenate multiple iterables - `accumulate(iterable)`: Cumulative sums - `product(iter1, iter2)`: Cartesian product - `permutations(iterable, r)`: All r-length permutations - `combinations(iterable, r)`: All r-length combinations - `groupby(iterable, key)`: Group items by a key (requires sorting) - **`yield`**: - Generators create lazy iterators using `yield`, saving memory <br/> ## 3. Decorators - **Definition**: A decorator is a higher-order function that allows you to modify the behavior of functions or methods. - **Creating & Using**: Syntax for creating decorators, usage of `@decorator_name`. - **Example**: - Simple function decorators - Example using `@njit` (from NumPy/Numba for JIT compilation). - **Higher-Order Functions**: Explanation of wrappers and how decorators use them. <br/> ## 4. Iterators and Generators - **Iterators**: Explanation of the iterator protocol (`__iter__()` and `__next__()`). - **Generators**: - Using `yield` to create generator functions. - Generator expressions (similar to list comprehensions). - **Generator Object**: Discussion of how generators are iterable objects. - **Itertools**: Common utilities from the `itertools` library (e.g., `chain`, `combinations`, `permutations`). <br/> ## 5. Concurrency - **Concurrency Concepts**: Definition and examples of concurrency, multitasking. - **Multithreading**: - Using Python’s `threading` module. - Global Interpreter Lock (GIL) and its impact on Python threads. - **Asynchronous Programming**: - Usage of `asyncio` for async I/O operations. - Using `concurrent.futures` for parallelism. - Example: async function with `asyncio`. <br/> ## 6. Logging - **Logging Principles**: Why logging is important in applications. - **Logging Levels**: DEBUG, INFO, WARNING, ERROR, CRITICAL. - **Logging Handlers**: FileHandler, StreamHandler, RotatingFileHandler. - **Basic Configuration**: - Using `logging.basicConfig()`. - Example of creating custom loggers, handlers, and formatters. - Writing logs to a file and rotating logs. <br/> ## 7. Pygame - **Introduction to GameDev Concepts**: Overview of game elements such as surfaces, sprites, and collisions. - **Basic Game Elements**: - Surfaces, sprites, and handling input events. - Collision detection (`collidepoint`). - **Graphics Libraries**: Integration with other libraries like OpenGL and OpenCV. - **Example**: Simple puzzle game with Pygame. <br/> ## 8. Web Frameworks ### Django - **MVC Pattern**: Explanation of the Model-View-Controller pattern. - **ORM**: Using Django’s Object-Relational Mapping (ORM) system for database operations. - **Form Handling**: Creating and processing HTML forms in Django. - **Templating**: Using Django’s templating language for dynamic content. ### Flask - **Routing and Middleware**: Handling routes and middleware in Flask. - **Request Handling**: Processing GET, POST requests. - **Blueprints**: Organizing large Flask applications with blueprints. - **Integration with Frontend**: Using Jinja2 templates, integrating with AJAX for frontend interactions. <br/> ## 9. Machine Learning ### Basic Concepts - **Supervised vs. Unsupervised Learning**: Definition and key differences. - **Regression vs. Classification**: Differences and examples. ### Libraries - **NumPy & Pandas**: - Data manipulation and analysis. - Examples of data handling with `DataFrame`. - **Scikit-Learn**: - Training and evaluating models. - Common algorithms like Linear Regression, Decision Trees, SVM. ### Deep Learning - **TensorFlow & Keras**: - Building and training neural networks. - Hyperparameter tuning and evaluation. - **PyTorch**: - Tensors, autograd, and building neural networks. - Custom training loops. <br/> ## 10. Model Deployment - **ONNX**: - Exporting models in the Open Neural Network Exchange format. - Integration with other frameworks. - **Serving Models**: - Using Flask or FastAPI to serve machine learning models as APIs. <br/> ## 11. Advanced Topics ### Algorithms (Python Practice) - **Sorting algorithms**: Bubble, Insertion, Merge Sort, Quick Sort - **Searching algorithms**: Linear Search, Binary Search - **Backtracking** - **Greedy algorithms** - **Graph traversal**: DFS, BFS (with `queue`, `deque`) - **Recursion & divide and conquer** - **Dynamic Programming** (memoization, tabulation) - **Big-O notation** & **complexity analysis** ### Transfer Learning - **Transfer Learning**: Reusing pre-trained models for new tasks. - **Fine-Tuning**: Adjusting pre-trained models for specific datasets. ### GANs - **Generative Adversarial Networks (GANs)**: Overview of GANs, how they work, and common applications. ### Reinforcement Learning - **Basic Concepts**: Overview of reinforcement learning, agents, actions, rewards, and environment. <br/> :::spoiler __Relevant Resources__ #### • [Python 基礎語法系列](/rirdIkdWRh6Thlx93gJ6YQ) :::

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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