Skip to main content

Python

Python是一種廣泛使用的直譯式、進階程式、通用型程式語言,由吉多·范羅蘇姆創造,第一版釋出於1991年。Python是ABC語言的後繼者,也可以視之為一種使用傳統中綴表達式的LISP方言。Python的設計哲學強調代碼的可讀性和簡潔的語法。相比於C++或Java,Python讓開發者能夠用更少的代碼表達想法。

Learning

Online Tutorials The Python Tutorial The Hitchhiker’s Guide to Python How to make an awesome...

pip

Installation NOTE: The following commands still require internet connection. get-pip.py # Late...

maxmind_db_ip_geolocator.py

Original Post: Python Basics for Hackers, Part 4: How to Find the Exact Location of any IP Addres...

Tips

編碼 UTF-8 宣告 #!/usr/bin/python # -*- coding: utf-8 -*- Find all installed modules help("module...

Functions

參數類型定義範例 def _gpt_parse_images( image_infos: List[Tuple[str, List[str]]], prom...

THSRC API

Links TDX 運輸資料通服務 TDX 會員註冊 TDX運輸資料流通服務API介接範例程式碼說明 TDX - 高鐵 API 說明 雙鐵API資料使用注意事項 API 虛擬點數...

JSON

JSON to dict json.loads 用來轉換資料; json.load 用來讀檔。 import json person = '{"name": "Bob", "langu...

Datetime

String to Datetime from datetime import datetime date_str = '09-19-2022' date_object = dat...

One-Liners

1) Multiple Variable Assignment # Traditional way a = 1 b = "ok" c = False # Pythonic way...

List

list.append() numbers = [1, 2, 3, 4] numbers.append(5) print(numbers) # output: [1, 2, 3, ...

String

Sample codes secret_password = 'jhk7GSH8ds' print('Password hint: the third letter of your pass...

Installation

Poetry Doc: https://python-poetry.org/docs/  Poetry 應該要安裝在 Python 虛擬環境,與主要系統間做隔離。 curl -sS...

Unit Test

Tutorial Pytest YT: How To Write Unit Tests in Python • Pytest Tutorial - YouTube