You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just a little confused with the code.
I mean...is Connie really dead or just a figment of his imagination.
Lol I'm trying to fit in the code with python. You can help me.
monkey/0004/README.md
@@ -0,0 +1,5 @@
+###题目要求
+任一个英文的纯文本文件,统计其中的单词出现的个数。
+
+###Topic request
+in a English plain text file, you must count the number of every word that
appear in it.
Sign in to comment
or sign up to join this conversation on GitHub
monkey/0004/main.py
@@ -0,0 +1,33 @@
+import re
+
+author = 'monkey'
+
+def countWords():
打开文件
with open('text.txt', 'r') as file:
data = file.read()
words = re.compile(r'([a-zA-Z]+)')
统计每个单词出现个个数
dic = {}
for i in words.findall(data):
if i not in dic:
dic[i] = 1
else:
dic[i] += 1
将字典里面的item保存到list中
numlist = []
for k,value in dic.items():
numlist.append((k, value))
排序
numlist.sort(key = lambda t:t[0])
输出结果
for i in numlist:
print(i[0], i[1])
+if name == 'main':
countWords()
monkey/0004/text.txt
@@ -0,0 +1,29 @@
+Most people need to hear those "three little words" I love you. Once in a
while, they hear them just in time.
+I met Connie the day she was admitted to the hospice ward, where I worked
as a volunteer. Her husband, Bill, stood nervously nearby as she was
transferred from the gurney to the hospital bed. Although Connie was in the
final stages of her fight against cancer, she was alert and cheerful. We
got her settled in. I finished marking her name on all the hospital
supplies she would be using, then asked if she needed anything.
+
+"Oh, yes," she said, "would you please show me how to use the TV? I enjoy
the soaps so much and I don't want to get behind on what's happening."
Connie was a romantic. She loved soap operas, romance novels and movies
with a good love story. As we became acquainted, she confided how
frustrating it was to be married 32 years to a man who often called her "a
silly woman."
+
+"Oh, I know Bill loves me," she said, "but he has never been one to say he
loves me, or send cards to me." She sighed and looked out the window at the
trees in the courtyard. "I'd give anything if he'd say 'I love you,' but
it's just not in his nature."
+
+Bill visited Connie every day. In the beginning, he sat next to the bed
while she watched the soaps. Later, when she began sleeping more, he paced
up and down the hallway outside her room. Soon, when she no longer watched
television and had fewer waking moments, I began spending more of my
volunteer time with Bill.
+
+He talked about having worked as a carpenter and how he liked to go
fishing. He and Connie had no children, but they'd been enjoying retirement
by traveling, until Connie got sick. Bill could not express his feelings
about the fact that his wife was dying.
+
+One day, over coffee in the cafeteria, I got him on the subject of women
and how we need romance in our lives; how we love to get sentimental1 cards
and love letters.
+
+"Do you tell Connie you love her?" I asked (knowing his answer), and he
looked at me as if I was crazy.
+
+"I don't have to," he said. "She knows I do!"
+
+"I'm sure she knows," I said, reaching over and touching his hands rough,
carpenter's hands that were gripping the cup as if it were the only thing
he had to hang onto "but she needs to hear it, Bill. She needs to hear
what she has meant to you all these years. Please think about it."
+
+We walked back to Connie's room. Bill disappeared inside, and I left to
visit another patient. Later, I saw Bill sitting by the bed. He was holding
Connie's hand as she slept. The date was February 12.
+
+Two days later I walked down the hospice ward at noon. There stood Bill,
leaning up against the wall in the hallway, staring at the floor. I already
knew from the head nurse that Connie had died at 11 A.M..
+
+When Bill saw me, he allowed himself to come into my arms for a long time.
His face was wet with tears and he was trembling. Finally, he leaned back
against the wall and took a deep breath.
+
+"I have to say something," he said. "I have to say how good I feel about
telling her." He stopped to blow his nose. "I thought a lot about what you
said, and this morning I told her how much I loved her... and loved being
married to her. You shoulda2 seen her smile!"
+
+I went into the room to say my own goodbye to Connie. There, on the
bedside table, was a large Valentine card from Bill. You know, the
sentimental kind that says, "To my wonderful wife... I love you."
monkey/0013/README.md
@@ -0,0 +1,7 @@
+###题目要求:
+* 用Pyhton写一个爬图片的程序,爬这个链接里的日本妹子图片
+* 地址:http://tieba.baidu.com/p/2166231880
+
+###Topic request
+* Use Python to write a crawl program and crawl photos of Japanese girls
from url
+* URL:http://tieba.baidu.com/p/2166231880
monkey/0013/main.py
@@ -5,9 +5,6 @@
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/monkey-soft/python