-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.py
More file actions
60 lines (45 loc) · 1.97 KB
/
Copy pathmodule.py
File metadata and controls
60 lines (45 loc) · 1.97 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
/**
*
* █████▒█ ██ ▄████▄ ██ ▄█▀ ██████╗ ██╗ ██╗ ██████╗
* ▓██ ▒ ██ ▓██▒▒██▀ ▀█ ██▄█▒ ██╔══██╗██║ ██║██╔════╝
* ▒████ ░▓██ ▒██░▒▓█ ▄ ▓███▄░ ██████╔╝██║ ██║██║ ███╗
* ░▓█▒ ░▓▓█ ░██░▒▓▓▄ ▄██▒▓██ █▄ ██╔══██╗██║ ██║██║ ██║
* ░▒█░ ▒▒█████▓ ▒ ▓███▀ ░▒██▒ █▄ ██████╔╝╚██████╔╝╚██████╔╝
* ▒ ░ ░▒▓▒ ▒ ▒ ░ ░▒ ▒ ░▒ ▒▒ ▓▒ ╚═════╝ ╚═════╝ ╚═════╝
* ░ ░░▒░ ░ ░ ░ ▒ ░ ░▒ ▒░
* ░ ░ ░░░ ░ ░ ░ ░ ░░ ░
* ░ ░ ░ ░ ░
*/
'''
from datetime import datetime
from collections import namedtuple, deque, defaultdict, OrderedDict
import base64
print('------内建模块------')
print('------datetime------')
now = datetime.now()
print(now, type(now))
dt = datetime(2017, 5, 3, 9, 45)
print(dt.timestamp())
dt2 = dt.timestamp()
print(datetime.fromtimestamp(dt2))
print(datetime.utcfromtimestamp(dt2))
cday = datetime.strptime('2015-6-1 18:19:59', '%Y-%m-%d %H:%M:%S')
print(cday)
print(datetime.now().strftime('%a, %b %d %H:%M'))
print('-------collections-------')
Point = namedtuple('Point', ['x', 'y'])
p = Point(1, 2)
print(type(p))
q = deque(['a', 'b', 'c'])
q.append('x')
q.appendleft('y')
print(q)
dd = defaultdict(lambda: 'N/A')
dd['key1'] = 'abc'
print(dd['key2'])
d = dict([('a', 1), ('b', 2), ('c', 3)])
print(d)
print(base64.b64encode(b'aaaaa'))