


#強制使用浮點數,

typing可以使用Union
但dispatch不行,
會出現TypeError
Traceback (most recent call last):
File “c:\Python\RF Stable\untitled0.py”, line 7, in <module>
def myFunc(a: Union[float, int], b: Union[float, int]) -> Union[float, int]:
File “C:\ProgramData\Anaconda\lib\site-packages\multipledispatch\core.py”, line 68, in _
dispatcher.add(types, func)
File “C:\ProgramData\Anaconda\lib\site-packages\multipledispatch\dispatcher.py”, line 222, in add
raise TypeError(“Tried to dispatch on non-type: %s\n”
TypeError: Tried to dispatch on non-type: typing.Union[float, int]
In signature: <typing.Union[float, int], typing.Union[float, int]>
In function: myFunc




![Python: matplotlib如何控制legend的位置? ax.legend(handles=[patch], loc=’upper left’, bbox_to_anchor=(6/10, 3/5) Python: matplotlib如何控制legend的位置? ax.legend(handles=[patch], loc=’upper left’, bbox_to_anchor=(6/10, 3/5)](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2023/05/20230502163945_79.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python: 資料格式如 List[dict],如何快速將SN加入每一個dict中,以利Excel輸出?如何解包dict? **dict ; 將List[dict]的資料轉為pandas.DataFrame 長什麼樣子? Python: 資料格式如 List[dict],如何快速將SN加入每一個dict中,以利Excel輸出?如何解包dict? **dict ; 將List[dict]的資料轉為pandas.DataFrame 長什麼樣子?](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2024/02/20240208093926_0.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python: Regular Expression 正規表示法 正則表達式 import re ; pattn = “[\d]{4}\/[01][\d]\/[0123][\d] [\d]{6}” ; match = re .search (pattn,text) .group() Python: Regular Expression 正規表示法 正則表達式 import re ; pattn = “[\d]{4}\/[01][\d]\/[0123][\d] [\d]{6}” ; match = re .search (pattn,text) .group()](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/09/20220901154435_19.png?quality=90&zoom=2&ssl=1&resize=350%2C233)


近期留言