之前在下载港交所的文件的时候会碰到有些文件异常的情况,文件下载下来,但是不能打开.查到其他的方法不是判断错误就是很麻烦. 整理出一个非常简单的方法,将文件以二进制方式打开,然后判断文件的开头是否符合pdf标准: 处理我这个情况非常好用,不一定适用于所有情况 python实现: def is_pdf_by_path(path): with open(path, "rb") as f: data = f.read() if data and da
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Code.Login Starr_model = new Code.Login(); Code.InsuranceModel.InsuranceSegment_Result result = new InsuranceModel.InsuranceSegment_Result(); try { //判断接口请求是否成功 result = C