Python
文章平均质量分 83
EverNoob
simply bumping around
展开
-
Trailing Comma “Feature“ in Python
【代码】Trailing Comma “Feature“ in Python。转载 2023-11-25 17:44:43 · 129 阅读 · 0 评论 -
C vs. Python Operator Precedence: Beware of (Bitwise) Logical Op.
comparison operators in python and C have different precedence compared to bitwise and logical operators, beware.转载 2022-10-13 10:16:12 · 180 阅读 · 0 评论 -
Python: Function Annotation and “inspect“ module
https://peps.python.org/pep-3107/This PEP introduces a syntax for adding arbitrary metadata annotations to Python functions [1].Because Python’s 2.x series lacks a standard way of annotating a function’s parameters and return values, a variety of tools and转载 2022-09-14 18:48:53 · 185 阅读 · 0 评论 -
“context“ in C and Python
if”)..转载 2022-09-14 14:52:05 · 147 阅读 · 0 评论 -
Python Multi-level Import with ‘.‘
【代码】Python Multi-level Import。转载 2022-09-14 13:54:36 · 142 阅读 · 0 评论 -
Python Multiprocessing
official documentation:multiprocessing — Process-based parallelism — Python 3.10.4 documentationbreakdown of the API:Python multiprocessing - process-based parallelism in PythonMultiprocessing vs. Threading in Python: What you need to know.What.原创 2022-04-25 18:29:53 · 905 阅读 · 0 评论 -
TensorFlow .pb: Save and Display Models
What is the use of a *.pb file in TensorFlow and how does it work? - Stack OverflowBasicspbstands for protobuf. In TensorFlow, the protbuf file contains the graph definition as well as the weights of the model. Thus, apbfile is all you need to be a...原创 2022-03-25 10:55:49 · 2173 阅读 · 0 评论 -
Evaluating Object Detection Models Using Mean Average Precision (mAP)
ByAhmed Fawzy GadTo evaluate object detection models like R-CNN andYOLO, themean average precision (mAP)is used. The mAP compares the ground-truth bounding box to the detected box and returns a score. The higher the score, the more accurate the model...转载 2022-03-22 13:23:32 · 257 阅读 · 0 评论 -
Numpy and SIMD
Numpy is by its design a SIMD structure, which is best examplified by the list indexing feature:python - How to filter numpy array by list of indices? - Stack Overflowfilter_indices = [1,3,5]np.array([11,13,155,22,0xff,32,56,88])[filter_indices]原创 2022-02-17 11:02:35 · 1503 阅读 · 0 评论 -
Python Single Line Multiple Assignment
Multiple assignment in Python: Assign multiple values or the same value to multiple variables | note.nkmk.meIn Python, use the = operator to assign values to variables.You can assign values to multiple variables on one line.This article describes the follo转载 2022-02-16 17:14:16 · 232 阅读 · 0 评论 -
Python Environment Variable Access
How to Set and Get Environment Variables in PythonTo set and get environment variables in Python you can just use theosmodule:import os# Set environment variablesos.environ['API_USER'] = 'username'os.environ['API_PASSWORD'] = 'secret'# Get env..转载 2022-02-14 19:12:58 · 156 阅读 · 0 评论 -
Python: Numpy Byte Order
1. get native endianesspython - How to get endianness of numpy dtype - Stack Overflow2. numpy dtype byte order formatting: byteordernumpy.dtype.byteorder — NumPy v1.21 Manual3. array byte orderingByte-swapping — NumPy v1.21 Manual原创 2021-12-25 17:20:27 · 526 阅读 · 0 评论 -
Python Class
official doc:quick tutorial from:Python Classes and Objects - GeeksforGeeksPython Classes and ObjectsDifficulty Level :Easy Last Updated :10 Jun, 2021A class is a user-defined blueprint or prototype from which objects are created. Classes provid...转载 2021-12-24 16:48:28 · 215 阅读 · 0 评论 -
Python Datatype Conversions
Bytes & FloatBytes to Floatpython - Convert Bytes to Floating Point Numbers? - Stack Overflow==> structPython struct pack, unpack - JournalDevofficial doc:struct — Interpret bytes as packed binary data — Python 3.7.12 documentation.原创 2021-12-15 11:31:41 · 705 阅读 · 0 评论 -
Python: pass by object-reference
from:Is Python pass-by-reference or pass-by-value? | Robert Heaton“Suppose I say to Fat, or Kevin says to Fat, “You did not experience God. You merely experienced something with the qualities and aspects and nature and powers and wisdom and goodness o..转载 2021-11-27 11:31:28 · 416 阅读 · 0 评论 -
Python: Console Arguments
Parse Input ArgumentsPython - Command Line Arguments$ python test.py arg1 arg2 arg3==> use sys module==> sys.argv give all input arguments in a listParse Input Optionsargparse — Parser for command-line options, arguments and sub-comman原创 2021-11-26 15:49:18 · 435 阅读 · 0 评论 -
Python: Local and Public Packages
Official tutorial for making a publicly available package:Packaging Python Projects — Python Packaging User GuideMethods to import local python file/module/packages (for difference between module and package, see What's the difference between a Python ..转载 2021-11-26 11:30:15 · 116 阅读 · 0 评论 -
TOML and Python
TOMLofficial site:TOML: Tom's Obvious Minimal Languageofficial site for language packages:Home · toml-lang/toml Wiki · GitHubIntro.:https://en.wikipedia.org/wiki/TOMLTOMLis afile formatforconfiguration files. It is intended to be easy to r...原创 2021-11-25 18:30:04 · 786 阅读 · 0 评论 -
Numpy Array References
1. Basic Operations1.4.2. Numerical operations on arrays — Scipy lecture notes2. ManipulationArray manipulation routines — NumPy v1.21 Manual原创 2021-11-05 17:24:13 · 82 阅读 · 0 评论 -
Python Long String
from:formatting - How can I break up this long line in Python? - Stack OverflowHow would you go about formatting a long line such as this? I'd like to get it to no more than 80 characters wide:logger.info("Skipping {0} because its thumbnail was alrea.转载 2021-11-04 21:47:37 · 119 阅读 · 0 评论 -
Python File I/O
1. regularopen()read(), write(), readlline()close()Python File I/O: Read and Write Files in Python==> primary ref.Python - Files I/O7. Input and Output — Python 3.10.0 documentation(7.2) ==> definitive ref.2. Jsonload()dump()...原创 2021-10-28 18:41:29 · 109 阅读 · 0 评论 -
Python Tutorial Overview
Learn Python - Free Interactive Python Tutorialfast overviewPython Tutorialmore detailedPython - Files I/Ofile i/oJSON formatJSONpython official documentationjson — JSON encoder and decoder — Python 3.10.0 documentationtutorial shortPytho...原创 2021-10-18 10:23:46 · 83 阅读 · 0 评论 -
Python Learning Notes: Basics I, Intro
unless specified otherwise, all materials are from the tutorial provided by w3school:PythonTutorial目录SyntaxIndentationCommentVariableAssigning ValuesExample mul to mulExample one to mulUnpack a CollectionExampleOutput VariablesEx...原创 2021-08-14 19:50:04 · 172 阅读 · 0 评论 -
Python与C/C++相互调用(转+注)
一、问题 Python模块和C/C++的动态库间相互调用在实际的应用中会有所涉及,在此作一总结。二、Python调用C/C++1、Python调用C动态链接库 Python调用C库比较简单,不经过任何封装打包成so,再使用python的ctypes调用即可。(1)C语言文件:pycall.c/***gcc -o libpycall.so -shared -fPIC pycall.c*/ #include <stdio.h> ...转载 2021-06-16 10:06:00 · 601 阅读 · 0 评论