原创 git 添加、查看、刪除遠端項目地址

添加遠端項目地址 $ git remote add origin [email protected]:Waldenz/JupyterSrc.git 查看遠端項目地址 $ git remote -v origin https://githu

原创 github 私有庫變公有後 permission denied

又一個repo之前是私有的,在setting中make public後,push的時候報錯,Permission denied 如下: 解決方法: 查看遠端項目地址 $ git remote -v origin    https://g

原创 python 類對象轉json字符串

使用實例的 __dict__屬性,將類對象轉爲json格式字符串 import json class Person(object): def __init__(self): self.name = 'John'

原创 python json.dumps 中文編碼

python的json.dumps方法默認會輸出成這種格式"\u2535a\u35a2\u89bd",。 要輸出中文需要指定ensure_ascii參數爲False,indent=2 表示縮進 json.dumps({'text':"你

原创 Hanlp 安裝使用詳解

安裝 github https://github.com/hankcs/pyhanlp conda install -c conda-forge jpype1 pip install pyhanlp 使用命令 hanlp segment

原创 Hanlp詞性表

a    形容詞 ad    副形詞 ag    形容詞性語素 al    形容詞性慣用語 an    名形詞 b    區別詞 begin  僅用於始##始 bg    區別語素 bl    區別詞性慣用語 c    連詞 cc    

原创 github 項目預覽html文件

第一種方式: 在打開的源碼地址的url基礎上添加前綴 http://htmlpreview.github.io/?  ?後面加html文件地址 缺點: 速度慢 第二種方式: 在倉庫的 settings 中設置github pages 進行

原创 github pages 關於repository中的markdown文件中文亂碼問題

.md文件從repository發佈到github pages後,文件編碼會自動由utf-8轉爲utf-8 with BOM 解決方案: 直接將md文件保存爲utf-8 with BOM,重新提交。

原创 python 實例方法、類方法、靜態方法

實例方法: 即普通方法,默認有self參數,且只能被對象調用; 靜態方法: 用 @staticmethod裝飾的不帶self參數的方法,可以沒有參數,可以直接使用類名調用; 類方法: 默認有cls參數,可以被類和對象調用,需要加上 @cl

原创 python 移除 \ufeff

encoding不是用 utf-8, 使用 utf-8-sig f = open(r'a.txt', encoding='utf-8-sig')  

原创 docker 啓動、重啓、關閉服務

systemctl start docker 啓動 systemctl restart docker  重啓docker服務 systemctrl stop docker  關閉docker服務    

原创 圖表理解 準確率&精確率&召回率

很多書中都用TP、FP、FN、TN來表示數據的真實情況和預測情況的比例,用一個表來形象地看下數據的真實分佈。     TrueLabel(真實情況) 陽 陰 PredictedLabel (預測情況) 陽 真正例(TP) True

原创 cv2.imread 和PIL中的image.open圖片顯示區別 格式互相轉換

顯示區別 plt.imread和PIL.Image.open讀入的都是RGB順序,而opencv中cv2.imread讀入的是BGR通道順序 。cv2.imread會顯示圖片更藍一些。 以下代碼爲opencv imread和PIL庫中im

原创 mac matplotlib 圖片顯示問題 和 Python is not installed as a framework

Python is not installed as a framework 報錯問題 報錯信息如下: RuntimeError: Python is not installed as a framework. The Mac OS X