python - doubility-sky/daydayup GitHub Wiki

Python is a programming language that lets you work quickly and integrate systems more effectively. >>>Learn More

Learn

tutorial

  • learn-python Playground and cheatsheet for learning Python. Collection of Python scripts that are split by topics and contain code examples with explanations.
  • OnlinePythonTutor, Visualize Python, Java, JavaScript, TypeScript, Ruby, C, and C++ code execution in your Web browser http://pythontutor.com/
  • What the f*ck Python! 😱 Exploring and understanding Python through surprising snippets.

books

Practice

Libraries

  • Requests is an elegant and simple HTTP library for Python, built for human beings.
  • Pillow, The friendly PIL fork (Python Imaging Library) https://python-pillow.org
  • openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.
  • pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its own native GUI window.

Frameworks

  • Twisted is an event-based framework for internet applications, supporting Python 2.7 and Python 3.5+.

Web Frameworks for Python

  • Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user.
  • Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks.
  • FastAPI framework, high performance, easy to learn, fast to code, ready for production

GUI

  • BeeWare allows you to write your app in Python and release it on multiple platforms. No need to rewrite the app in multiple programming languages. It means no issues with build tools, environments, compatibility, etc.
  • Kivy: Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
    • python-for-android is a packaging tool for Python apps on Android. You can create your own Python distribution including the modules and dependencies you want, and bundle it in an APK along with your own code.
    • Kivy for iOS: Toolchain for compiling Python / Kivy / other libraries for iOS
  • wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before. Just like "Classic" wxPython, Phoenix wraps the wxWidgets C++ toolkit and provides access to the user interface portions of the wxWidgets API, enabling Python applications to have a native GUI on Windows, Macs or Unix systems, with a native look and feel and requiring very little (if any) platform specific code.
  • DearPyGui: A GPU Accelerated Python GUI Framework
  • fbs is the fastest way to create a Python GUI. It solves common pain points such as packaging and deployment. Based on Python and Qt, fbs is a lightweight alternative to Electron.
    • tutorial for creating Python/Qt GUIs with fbs

others

Crawlers

  • scrapy, An open source and collaborative framework for extracting the data you need from websites. In a fast, simple, yet extensible way.
  • pyspider, A Powerful Spider(Web Crawler) System in Python. http://docs.pyspider.org/
  • Portia is a tool that allows you to visually scrape websites without any programming knowledge required. With Portia you can annotate a web page to identify the data you wish to extract, and Portia will understand based on these annotations how to scrape data from similar pages.
  • Newspaper3k: Article scraping & curation, News, full-text, and article metadata extraction in Python 3. Advanced docs: https://goo.gl/VX41yK
  • Grab is a python web scraping framework. Grab provides a number of helpful methods to perform network requests, scrape web sites and process the scraped content ...

Tools

  • pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
    • pyenv install -l List all available versions
    • pyenv install 2.7.18
    • pyenv versions Show the current Python version(s) and its origin
    • pyenv global 2.7.18
    • python --version
    • FAQ: after pyenv global system got: pyenv: python: command not found ... on macOS 12+
      • ln -s /usr/local/bin/python3 /usr/local/bin/python

FAQs

格式:pyinstaller --add-data="SRC;DST"
例如将第三方库zhconv/zhcdict.json打包到zhconv目录下:
# cmd:
  pyinstaller --add-data="%LocalAppData%\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\zhconv\zhcdict.json;zhconv" -F translate.py --distpath "."
# powershell:
  pyinstaller --add-data="$env:LocalAppData\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\zhconv\zhcdict.json;zhconv" -F translate.py --distpath "."

Resources