Skip to content

Commit d5d03c3

Browse files
authored
Merge pull request Show-Me-the-Code#195 from lenzzz/master
Master
2 parents d87b88d + 9a657d9 commit d5d03c3

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

lenzzz/0004/artical.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sherlock Holmes took his bottle from the corner of the mantel-piece and his hypodermic syringe from its neat morocco case. With his long, white, nervous fingers he adjusted the delicate needle, and rolled back his left shirt-cuff. For some little time his eyes rested thoughtfully upon the sinewy forearm and wrist all dotted and scarred with innumerable puncture-marks. Finally he thrust the sharp point home, pressed down the tiny piston, and sank back into the velvet-lined arm-chair with a long sigh of satisfaction.
2+
3+
Three times a day for many months I had witnessed this performance, but custom had not reconciled my mind to it. On the contrary, from day to day I had become more irritable at the sight, and my conscience swelled nightly within me at the thought that I had lacked the courage to protest. Again and again I had registered a vow that I should deliver my soul upon the subject, but there was that in the cool, nonchalant air of my companion which made him the last man with whom one would care to take anything approaching to a liberty. His great powers, his masterly manner, and the experience which I had had of his many extraordinary qualities, all made me diffident and backward in crossing him.

lenzzz/0004/main.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
f = open('artical.txt','r')
2+
artical = f.read()
3+
f.close()
4+
5+
punctuation = ",.\"\'?!\n"
6+
7+
for p in punctuation:
8+
artical = artical.replace(p," ")
9+
10+
words = {}
11+
12+
for word in artical.split(" "):
13+
if word in words:
14+
words[word] += 1
15+
else:
16+
words[word] = 1
17+
18+
for key in words:
19+
if key == " ":
20+
continue
21+
print key,words[key]

lenzzz/0013/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# python3
2+
#coding:utf-8
3+
import requests
4+
from bs4 import BeautifulSoup
5+
6+
def downloadPic(url):
7+
req = requests.get(url)
8+
imageName = url.split('/')[-1]
9+
with open(imageName, 'wb') as fp:
10+
fp.write(req.content)
11+
12+
html = requests.get("http://tieba.baidu.com/p/2166231880").content
13+
soup = BeautifulSoup(html, "html.parser")
14+
for img in soup.find_all("img", {"class", "BDE_Image"}):
15+
downloadPic(img['src'])
16+

0 commit comments

Comments
 (0)