Skip to content

Instantly share code, notes, and snippets.

View sinchantsao's full-sized avatar
🎯
Focusing

Sin Chan sinchantsao

🎯
Focusing
View GitHub Profile
@sinchantsao
sinchantsao / round.py
Last active January 17, 2021 14:43
how to round to 2 decimal ignoring any shit storage method in disk
"""
>>> round(2.5)
2
>>> round(3.5)
4
>>> round(4.5)
4
>>> round(1.555, 2)
1.55
>>> round(1.556, 2)
@sinchantsao
sinchantsao / depressZipFile.py
Last active December 6, 2019 12:21
解决zipfile解压中文压缩包乱码问题,以及文件加密判断,这里只做解压乱码的问题处理,未实现加密文件解压
# coding=utf8
# !/usr/bin/python2.7
import chardet
import os
import zipfile
def decompressChar(string, encode=None):
try:
if isinstance(string, unicode):