Skip to content

Instantly share code, notes, and snippets.

#读取本地E:\python_pro\本地脚本\sample.html文件,并将其中的表格数据提取出来
import pandas as pd
from bs4 import BeautifulSoup
import json
# 定义一个结构体类
class Struct:
def __init__(self, link, target, imgPath, before_p, after_p):
self.link = link
self.target = target
#python
import json,urllib
from urllib.parse import urlencode
import urllib.request
url = 'http://api.k780.com/'
params = {
'app' : 'finance.rate',
'scur' : 'USD',
@jianghu52
jianghu52 / closure example
Created September 29, 2015 01:11
闭包例子
var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
return function(){
return this.name;
};
}
};
alert(object.getNameFunc()()); //out put The window
@jianghu52
jianghu52 / smzdm
Created April 22, 2015 02:53
smzdm_fail
# coding: utf-8
import urllib2
def auto_check():
opener = urllib2.build_opener()
opener.addheaders = [
('User-Agent', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36')
]
#!/usr/bin/env python
# coding: utf-8
import os
import sys
# 将系统的编码设置为UTF8
reload(sys)
sys.setdefaultencoding('utf8')
from struct import *
ofile=open('sz000680.day','rb')
buf=ofile.read()
ofile.close()
ifile=open('sz000680.txt','w')
num=len(buf)
no=num/32
b=0
e=32
@jianghu52
jianghu52 / xiami.py
Last active August 29, 2015 14:10 — forked from fdb713/xiami.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
File: xiami.py
Author: Luigi Fan
Description: Auto check-in script for xiami.
'''
import requests
import re
@jianghu52
jianghu52 / addtime
Created June 14, 2014 09:20
简单的一个算时间的小程序,主要是用于发日报用
<?php
date('H');
date('Y-m-d H:i:s');
$endTime_h = date('H');
$endTime_m = date('i');
echo $endTime_m;echo "<br/>";
if($endTime_m > 30){
$work_m = 0.5;
}else{
a1 = Point(1, 5)
b1 = Point(4, 5)
c1 = Point(1, 2)
d1 = Point(4, 2)
r = Rectangle(a1, b1, c1, d1)
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
a = Point(1, 4)
b = Point(4, 4)
c = Point(1, 2)
d = Point(4, 2)