forked from hellowego/auto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
66 lines (46 loc) · 1.95 KB
/
test.py
File metadata and controls
66 lines (46 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*-coding=utf8-*-
import datetime
import time
class Test():
@classmethod
def time2Stamp(cls):
# 今天的日期
today = datetime.date.today()
print today
print today.timetuple()
# 今天日期的时间戳 mktime 输入参数struct_time对象 返回时间戳
todayStamp =int(time.mktime(today.timetuple()))
print todayStamp
# 当前时间的时间戳
now = int(time.time())
print now
print now - todayStamp - 3600*24
print (now - todayStamp)/3600
# localtime 返回struct_time对象
t = time.localtime(todayStamp)
# strftime 参数t是一个struct_time对象 返回字符串
timeStr = time.strftime('%Y-%m-%d %H:%M', t)
print timeStr
print t
# 返回struct_time对象
t1 = time.gmtime(now)
print t1
if __name__ == "__main__":
# Test.time2Stamp()
result = '''<ul>
<li>
<a class="aw-user-name" href="http://wenda.wecenter.com/people/seosns" data-id="8884"><img src="http://wenda.wecenter.com/uploads/avatar/000/00/88/84_avatar_min.jpg" alt="" /></a>
<div>
<p class="clearfix">
<span class="pull-right">
<a href="javascript:;" onclick="if ($(this).parents('.aw-comment-box').find('form textarea').val() == $(this).parents('.aw-comment-box').find('form textarea').attr('placeholder')){$(this).parents('.aw-comment-box').find('form textarea').val('');};$(this).parents('.aw-comment-box').find('form').show().find('textarea').focus();$(this).parents('.aw-comment-box').find('form textarea').insertAtCaret('@seosns:');$.scrollTo($(this).parents('.aw-comment-box').find('form'), 300, {queue:true});$(this).parents('.aw-comment-box').find('textarea').focus();">回复</a> </span>
<a href="http://wenda.wecenter.com/people/seosns" class="aw-user-name author" data-id="8884">seosns</a> • <span>2015-04-17 21:45</span>
</p>
<p class="clearfix">%s</p>
</div>
</li>
</ul>'''
a = ' hi, /%s, hello %s'
b = a %('jack', 'tom')
c = result %('hiiiiii')
print c