[python] Remove duplicate items from a list using set
How to remove repeated item in array / list in python?
http://love-python.blogspot.tw/2008/09/remove-duplicate-items-from-list-using.html
http://love-python.blogspot.tw/2008/09/remove-duplicate-items-from-list-using.html
random integer array
np.random.randint(_random_within_this_value, size(_row, _column))
output: _row*_column 的 random integer array
output: _row*_column 的 random integer array
[python] sign(x) - 傳回 x 的正負值
要馬是
import numpy as np
np.sign(x)
不然也有內建函式
利用 math.copysign(1, y) 可以傳回 y 的正負值
import numpy as np
np.sign(x)
不然也有內建函式
利用 math.copysign(1, y) 可以傳回 y 的正負值
不用 x / abs(x)
[python] pass by reference or value 參數是傳參考還是傳值?
Referencing: Python: How do I pass a variable by reference, Passing values in Python
其實重點是在 data type.
其實重點是在 data type.
到底在寫 function 的時候,傳的參數 (argument, parameter) 是 reference or value?
全部都是passes references-to-objects by value (like Java), 只是 mutable data type would act like pass by reference
[python] Parsing, Decoding, Read json
Referencing: parsing json python, python json decoding
These two article should be clear enough! 這兩篇應該就蠻清楚的了!
* JSON objects behave like dictionaries, JSON format is a list containing objects
-> access object by json[object], and len(json) would get the length of json
-> using iterator on a dictionary, hence can be used on json format.
get keys by simple dict.keys(), get values by simple dict.values()
http://www.python.org/dev/peps/pep-3106/
These two article should be clear enough! 這兩篇應該就蠻清楚的了!
* JSON objects behave like dictionaries, JSON format is a list containing objects
-> access object by json[object], and len(json) would get the length of json
-> using iterator on a dictionary, hence can be used on json format.
get keys by simple dict.keys(), get values by simple dict.values()
http://www.python.org/dev/peps/pep-3106/
[python] matplotlib.pyplot point and line styles
[優] plt.examples http://hyry.dip.jp:8000/pydoc/matplotlib_intro.html
訂閱:
文章
(
Atom
)