Пример #1
0
def auto_get_url(msg):
    response = requests.get(msg.url)
    from pyquery import PyQuery as py
    document = py(response.text) 
    content = document('#js_content').text()
    text1 = stats_word.stats_word(content,100)
    text2 = str(text1)
    bot.file_helper.send(text1)
    return text2
Пример #2
0
import yagmail
import requests
from mymodule import stats_word
response = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA')

from pyquery import PyQuery as py
document = py(response.text)
content = document('#js_content').text()

text1 = stats_word.stats_word(content, 100)

import getpass
sender = input('请输入发件人邮箱:')
password = getpass.getpass('请输入发件人邮箱密码(可复制粘贴):')
recipients = '*****@*****.**'  #input('请输入收件人邮箱:')
host = 'smtp.163.com'

yag = yagmail.SMTP(sender, password, host)
subject1 = '自学训练营学习3群 DAY11 chunsmile'
text2 = str(text1)
yag.send(recipients, subject=subject1, contents=text2)
Пример #3
0
So Yugong, his sons, and his grandsons started to break up rocks and
remove the earth. They transported the earth and rubble to the Sea of
Bohai.
Now Yugong’s neighbour was a widow who had an only child eight years
old. Evening the young boy offered his help eagerly.
Summer went by and winter came. It took Yugong and his crew a full
year to travel back and forth once.
On the bank of the Yellow River dwelled an old man much respected for
his wisdom. When he saw their back-breaking labour, he ridiculed
Yugong saying,”Aren’t you foolish, my friend? You are very old now,
and with whatever remains of your waning strength, you won’t be able
to remove even a corner of the mountain.”
Yugong uttered a sigh and said,”A biased person like you will never
understand. You can’t even compare with the widow’s little boy!”
“Even if I were dead, there will still be my children, my
grandchildren, my great grandchildren, my great great grandchildren.
They descendants will go on forever. But these mountains will not
grow any taler. We shall level them one day!” he declared with
confidence.
The wise old man was totally silenced.
When the guardian gods of the mountains saw how determined Yugong and
his crew were, they were struck with fear and reported the incident
to the Emperor of Heavens.
Filled with admiration for Yugong, the Emperor of Heavens ordered two
mighty gods to carry the mountains away.
'''

from mymodule import stats_word

stats_word.stats_word(text)
Пример #4
0
old. Evening the young boy offered his help eagerly.
Summer went by and winter came. It took Yugong and his crew a full
year to travel back and forth once.
On the bank of the Yellow River dwelled an old man much respected for
his wisdom. When he saw their back-breaking labour, he ridiculed
Yugong saying,”Aren’t you foolish, my friend? You are very old now,
and with whatever remains of your waning strength, you won’t be able
to remove even a corner of the mountain.”
Yugong uttered a sigh and said,”A biased person like you will never
understand. You can’t even compare with the widow’s little boy!”
“Even if I were dead, there will still be my children, my
grandchildren, my great grandchildren, my great great grandchildren.
They descendants will go on forever. But these mountains will not
grow any taler. We shall level them one day!” he declared with
confidence.
The wise old man was totally silenced.
When the guardian gods of the mountains saw how determined Yugong and
his crew were, they were struck with fear and reported the incident
to the Emperor of Heavens.
Filled with admiration for Yugong, the Emperor of Heavens ordered two
mighty gods to carry the mountains away.
'''

from mymodule import stats_word
text3 = 123
#stats_word.stats_text_cn(text3)   #验证参数检查功能是否生效

try:
    stats_word.stats_word(text3)
except ValueError:
    print("Error:文本为非字符串")