-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.py
More file actions
92 lines (56 loc) · 1.46 KB
/
test.py
File metadata and controls
92 lines (56 loc) · 1.46 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
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @author: liukelin 314566990@qq.com
import time
import datetime
import urllib3
import string
import re
import sys
# reload(sys)
# sys.setdefaultencoding('utf8')
# print("==%s==" % time.time())
# print("==%s==" % time.time())
def get_html(url):
http = urllib3.PoolManager()
r = http.request('GET', url)
m = r.data
page_data = m.decode('UTF-8')
page_ = re.compile('<img src=\"(.+?)\"')#匹配img正则
for d in page_.findall(page_data):
pass
def up_num():
# 问题:有两个数,之和是两位数,且这两个数字相同;之积是三位数,且这三个数字相同,求这两个数。
for i in range(1,100):
for k in range(1,100):
st1 = i+k
st2 = i*k
if len(str(st1))!=2:
continue
if len(str(st2))!=3:
continue
if st1/int(str(st1)[0])!=11:
continue
if st2/int(str(st2)[0])!=111:
continue
print(i,k)
up_num()
image = 'http://d.3.cn/desc/1856588?cdn=2&callback=showdesc'
http = urllib3.PoolManager()
m2 = http.request('GET', image)
image_data = m2.data
print(image_data)
# quest = input("What is your quest?\r\n")
ss = ["a", "b", "c"]
ss.insert(0,"1")
print(ss)
def up_code():
# windows-1252 转 utf-8
f = open('/Users/liukelin/Documents/书籍/text.txt')
stt = f.read() #.decode('windows-1252')
f.close()
print(stt)
stt.decode('windows-1252').encode('utf-8')
f = open('/Users/liukelin/Documents/书籍/text2.txt')
f.write(str2)
up_code()