Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

struct trong python

from collections import namedtuple

Something = namedtuple("Something", ["x", "y"])
p1 = Point(1, 2)
print(p1)
# gọi attribute
print(p1.x, p1.y)
# gọi theo chỉ số
print(p1[0], p1[1])

# nếu có ý định gán thì error ngay lập tức
p1.x = 2  # lỗi AttributeError: can't set attribute
Comment

PREVIOUS NEXT
Code Example
Python :: pandas get only entries that match list 
Python :: EXCEL , EXTRAER DELIMITADOR 
Python :: django rest DjangoModelPermissions include get 
Python :: download python for windows 7 32-bit 
Python :: ffmpeg python slow down frame rate 
Python :: inline_ternary(if)_condition 
Python :: generate jwt token just passing userid in rest_framework_simplejwt 
Python :: python argparse one or the other 
Python :: can we put the object as value in a dictionary in python* 
Python :: filter all columns in pandas 
Python :: asdict that ignore sentinel 
Python :: python nltk lookup error Resource omw-1.4 not found. 
Python :: pairplot legend position 
Python :: overlay bar plot and line plot in python 
Python :: flassger 
Python :: insertion sort algorithm in descending order 
Python :: Examples pandas.read_hfd5() 
Python :: tuple with mixed data types 
Python :: numpy random sin 
Python :: for loop for many integers in list 
Python :: python to uml 
Python :: OSError Traceback (most recent call last) <ipython-input-74-8920269c5588 in <module() 9 10 run_with_ngrok(app) --- 11 app.run() 
Python :: python subprocess call with no environment variable 
Python :: pathlib home 
Python :: how to extract a list of values from numpy array using index list 
Python :: create game board with radone values within a range python 
Python :: Python NumPy hsplit Function 
Python :: Python how to use __ge__ 
Python :: get forex exchange rates in python 
Python :: django view - apiview decorator (retrieve, update or delete - GET, PUT, DELETE) 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =