Skip to content

Commit 3e9abb1

Browse files
committed
Merge branch 'master' of https://github.com/GuangkunYu/python
2 parents 324b3d3 + 28e39c7 commit 3e9abb1

File tree

10 files changed

+158
-0
lines changed

10 files changed

+158
-0
lines changed

PyQT5/QtDemo01/.idea/QtDemo01.iml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyQT5/QtDemo01/.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyQT5/QtDemo01/.idea/misc.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyQT5/QtDemo01/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyQT5/QtDemo01/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PyQT5/QtDemo01/.idea/workspace.xml

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
10.1 KB
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import urllib.request
2+
response = urllib.request.urlopen("http://www.fishc.com")
3+
html = response.read().decode("utf8")
4+
print(html)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import urllib.request
2+
3+
response = urllib.request.urlopen("http://placekitten.com/g/200/300")
4+
image = response.read()
5+
6+
with open("spiders\\imgs\\cat_200_300.jpg", "wb") as f:
7+
f.write(image)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import urllib.request
2+
import urllib.parse
3+
import json
4+
5+
url = "http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule"
6+
fanyi = "我好帅"
7+
head = {
8+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.58"
9+
}
10+
11+
data = {
12+
"i": fanyi,
13+
"to": "AUTO",
14+
"smartresult": "dict",
15+
"client": "fanyideskweb",
16+
"salt": "16043223044352",
17+
"sign": "65234980dec8e3166abae7d62f3b9a90",
18+
"lts": "1604322304435",
19+
"bv": "152ab8d037e123e288bdd3fea870d639",
20+
"doctype": "json",
21+
"version": "2.1",
22+
"keyfrom": "fanyi.web",
23+
"action": "FY_BY_REALTlME"
24+
}
25+
data = urllib.parse.urlencode(data).encode("utf-8")
26+
27+
response = urllib.request.urlopen(url, data)
28+
29+
html = response.read().decode("utf-8")
30+
31+
target = json.loads(html)
32+
print(target['translateResult'][0][0]['tgt'])

0 commit comments

Comments
 (0)