본문 바로가기

Programming65

python SSLerror "certificate verify failed: unable to get local issuer certificate" "ConnectionError: Couldn't reach '~~~~~' on the Hub (SSLError)" huggingface 쓰면서 조우한 error인데 huggingface에만 국한된건 아니고 urllib 나 requests 등 https 통신 할때 발생하는 SSLerror 이다. 내 환경은 우분투 였고 https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror 이곳 통해 해결 # debian os.environ['REQUESTS_CA_BUNDLE'] = os.path.join( '/etc/.. 2023. 10. 27.
간결한 python 문법을 쓰자 - lambda python 스러운 코드를 짜자 ex. flatten = lambda l: [item for sublist in l for item in sublist] #을 풀어서 쓰면 def flatten(l:list): a = [] for i in l: for j in i: a.append(j) return a 2022. 5. 9.
간결한 python 문법을 쓰자 - one line condition python 스러운 코드를 짜자 ex. dG ={} current_node = 1 default_p = 0.1 p = dG.get('p_val', default_p) if current_node in dG else default_p #이 한줄코드를 길게 짜면 if current_node in dG: if 'p_val' not in dG[current_node]: p = default_p else: p = dG[current_node]['pval'] else: p = default_p 코드가 짧아지면 좋지만 그건 가독성 & 명료성을 높이는 방향으로 짧아져야 한다. dictionary 의 get(key, default_value) one-line if condition은 가독성도 높이고 간결성도 높인다. 2022. 4. 12.
[vscode] Explorer에서 single click로 fileopen 하고 싶지 않을때 (double click 설정) GB단위 csv파일이 있을 경우 눌렀다가 그것 로드하느라 vscode가 죽는 경우가 있다. 해결방법은 ? Preference > setting > "workbench.list.openMode": "doubleClick", 2021. 11. 25.