JupyterLab/test.ipynb
2024-01-18 21:08:36 +08:00

223 lines
10 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"title= 青岛:迎春花灯美轮美奂 市民观赏其乐陶陶\n",
"author= []\n",
"publish_date= None\n",
"summary= \n",
"text= 2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"2021年2月15日晚山东青岛西海岸新区金沙滩啤酒城花灯璀璨赏心悦目。当日各式花灯流光溢彩市民和游客被美轮美奂的多种牛的造型花灯和十二生肖花灯吸引其乐陶陶共享新春灯会带来的欢乐和艺术盛宴。\n",
"\n",
"责编:吕原 \n",
"\n",
"images= {'https://appimg.dzwww.com/2021/0216/602af8081c74c.jpg', 'https://appimg.dzwww.com/2021/0216/602af808209c1.jpg', 'http://hb.dzwww.com/images/hb.ico', 'http://hb.dzwww.com/images/pc/top-logo-hb.png?v=1', 'https://appapi.dzwww.com/images/icon/cities/.png', 'https://appimg.dzwww.com/2021/0216/602af80861c94.jpg', 'https://appimg.dzwww.com/2021/0216/602af8086df8a.jpg', 'https://appimg.dzwww.com/2021/0216/602af8082499d.jpg', 'http://hb.dzwww.com/images/pc/dyh.jpg?v=1', 'https://appimg.dzwww.com/share/2021/02/16/a7c665f6c127cdb.jpg', 'https://appimg.dzwww.com/2021/0216/602af80865b93.jpg', 'http://hb.dzwww.com/images/pc/code-btn2.gif', 'https://appimg.dzwww.com/2021/0216/602af8085dbd4.jpg', 'http://hb.dzwww.com/images/pc/code-btn1.gif', 'https://appimg.dzwww.com/2021/0216/602af8085ac7d.jpg', 'https://appimg.dzwww.com/2021/0216/602af8081e9a8.jpg', 'http://appimg.dzwww.com/dzcloud/20200519/6d4cb0f483c28be39a7acc4db0e5c209.jpg', 'https://appimg.dzwww.com/2021/0216/602af80828c60.jpg', 'https://uct01.dzwww.com/images/noavatar_middle.gif', 'https://appimg.dzwww.com/2021/0216/602af80822e80.jpg', 'http://hb.dzwww.com/images/pc/code.gif?v=1', 'https://appimg.dzwww.com/2021/0216/602af80872e82.jpg', 'http://hb.dzwww.com/images/pc/kfzsq.gif?v=1', 'https://appimg.dzwww.com/share/2021/02/17/cdfe65611cdecfc.jpg', 'http://hb.dzwww.com/images/pc/noavatar_middle.jpg'}\n"
]
}
],
"source": [
"import time\n",
"from newspaper import Article\n",
"\n",
"url = 'http://hb.dzwww.com/p/7882663.html'\n",
"# 创建文章对象\n",
"news = Article(url, language='zh')\n",
"# 下载网页\n",
"news.download()\n",
"## 网页解析\n",
"news.parse()\n",
"print(\"title=\",news.title)# 获取文章标题\n",
"print(\"author=\", news.authors) # 获取文章作者\n",
"print(\"publish_date=\", news.publish_date) # 获取文章日期\n",
"# 自然语言处理\n",
"#news.nlp()\n",
"#print('keywords=',news.keywords)#从文本中提取关键字\n",
"print(\"summary=\",news.summary)# 获取文章摘要\n",
"# time.sleep(30)\n",
"print(\"text=\",news.text,\"\\n\")# 获取文章正文\n",
"\n",
"#print(\"movies=\",news.movies) # 获取文章视频链接\n",
"#print(\"top_iamge=\",news.top_image) # 获取文章顶部图片地址\n",
"print(\"images=\",news.images)#从html中提取所有图像\n",
"#print(\"imgs=\",news.imgs)\n",
"#print(\"html=\",news.html)#获取html"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"ename": "error",
"evalue": "(1219, 'WNetAddConnection2', '不允许一个用户使用一个以上用户名与服务器或共享资源的多重连接。中断与此服务器或共享资源的所有连接,然后再试一次。')",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31merror\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-7-a6e527b02420>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mpassword\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'4167208'\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0mwin32wnet\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mWNetAddConnection2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mwin32netcon\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mRESOURCETYPE_DISK\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'U:'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'\\\\\\\\192.168.10.172\\\\web'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0musername\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpassword\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31merror\u001b[0m: (1219, 'WNetAddConnection2', '不允许一个用户使用一个以上用户名与服务器或共享资源的多重连接。中断与此服务器或共享资源的所有连接,然后再试一次。')"
]
}
],
"source": [
"import win32api\n",
"import win32net\n",
"import win32netcon,win32wnet\n",
"username='heibai2006'\n",
"password='4167208'\n",
"\n",
"win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, 'U:','\\\\\\\\192.168.10.172\\\\web', None, username, password, 0)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x小于100\n"
]
}
],
"source": [
"x=95+4\n",
"if x >100:\n",
" print(\"x大于100\")\n",
"elif x==100:\n",
" print(\"x等于100\")\n",
"else:\n",
" print(\"x小于100\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"2\n",
"4\n",
"6\n",
"8\n",
"10\n",
"12\n",
"14\n",
"16\n",
"18\n",
"20\n",
"22\n",
"24\n",
"26\n",
"28\n",
"30\n",
"32\n",
"34\n",
"36\n",
"38\n",
"40\n",
"42\n",
"44\n",
"46\n",
"48\n",
"50\n",
"52\n",
"54\n",
"56\n",
"58\n",
"60\n",
"62\n",
"64\n",
"66\n",
"68\n",
"70\n",
"72\n",
"74\n",
"76\n",
"78\n",
"80\n",
"82\n",
"84\n",
"86\n",
"88\n",
"90\n",
"92\n",
"94\n",
"96\n",
"98\n",
"100\n"
]
}
],
"source": [
"for i in range(0,101):\n",
" if i%2==0:\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:root] *",
"language": "python",
"name": "conda-root-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}