Skip to content

pull request#163

Merged
horx merged 2 commits into
Show-Me-the-Code:masterfrom
monkey-soft:master
Dec 31, 2015
Merged

pull request#163
horx merged 2 commits into
Show-Me-the-Code:masterfrom
monkey-soft:master

Conversation

@monkey-soft
Copy link
Copy Markdown
Contributor

@theoegui
Copy link
Copy Markdown

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 @@

author = 'monkey'

-# 题目要求:
-# 用Pyhton写一个爬图片的程序,爬这个链接里的日本妹子图片
-# 地址:http://tieba.baidu.com/p/2166231880

获取url地址,对页面进行爬去

def spider(url):
On Dec 29, 2015 11:57 PM, "YouYuan Chan" notifications@github.com wrote:

https://github.com/monkey-soft/python

You can view, comment on, or merge this pull request online at:

#163
Commit Summary

  • Update 0013
  • complete 0004

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#163.

horx added a commit that referenced this pull request Dec 31, 2015
@horx horx merged commit 349a92a into Show-Me-the-Code:master Dec 31, 2015
horx added a commit that referenced this pull request Dec 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants