python利用tkinter制作查询热映电影软件

Python Tkinter 实现评分系统(GUI) Tkinter :是 Python 的标准 GUI 库。Python 使用 Tkinter 可以快速的创建 GUI 应用程序。 由于 Tkinter 是内置到 python 的安装包中、只要安装好 Python 之后就能 import Tkinter 库、而且 IDLE 也是用 Tkinter 编写而成、对于简单的图形界面 Tkinter 还是能应付自如。(官方文档) 简单编写一个评分检测系统,实... 阅读详情
淘票票电影热榜网址:
https://dianying.taobao.com/showList.htm?spm=a1z21.6646273.city.2.4ed46d6ekOc3wH&n_s=new&city=310100

网站截图:

很多人学习python,不知道从何学起。
很多人学习python,掌握了基本语法过后,不知道在哪里寻找案例上手。
很多已经做案例的人,却不知道如何去学习更加高深的知识。
那么针对这三类人,我给大家提供一个好的学习平台,免费领取视频教程,电子书籍,以及课程的源代码!??¤
QQ群:961562169

在这里插入图片描述

spider4taopiaopiao.py

爬取网站电影排行榜
import requests
import re
import os
import time
import json

def mySpider():
    # 伪装 用于可以伪装成浏览器。
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
    }

    print("网页请求中...")
    time.sleep(0.5)
    url = "https://dianying.taobao.com/showList.htm?spm=a1z21.6646273.city.2.4ed46d6ekOc3wH&n_s=new&city=310100"
    response = requests.get(url, headers=headers)
    html = response.text # 获取html信息
    # print(html)
    print("网页信息已获取...")
    time.sleep(0.5)

    destinationPath = "result.txt"
    fd = open(destinationPath,"w+",encoding='utf-8')
    fd.writelines(html)

    end = html.find('<!-- 即将热映 -->')
    # print("位置为:",end)
    if end != -1:
        html = html[:end]

    fd.close()

    s = '<img width="160" height="224" data-src="(.*?)" src=' +\
        '.*?<span class="bt-l">(.+?)</span>.*?<span class="bt-r">(\d.\d)?</span>' + \
        ".*?<span>导演:(.*?)</span>" + ".*?<span>主演:(.*?)</span>" + ".*?<span>类型:(.*?)</span>"+\
        ".*?<span>地区:(.*?)</span>" + ".*?<span>语言:(.*?)</span>" + ".*?<span>片长:(.*?)</span>"
    pattern = re.compile(s,re.S)
    items = re.findall(pattern, html)

    # print(items)
    # print(type(items))
    # print(type(html))

    for outer in range(len(items)):
        items[outer] = list(items[outer])
        for i in range(len(items[outer])):
            if items[outer][i] == "":
                items[outer][i] = "暂无信息"
            else:
                # pass # &middot;
                items[outer][i] = items[outer][i].replace("&middot;","·") 

    # print(items)

    destinationPath = "items.json"
    fd = open(destinationPath,"w+",encoding='utf-8')
    json.dump(items,fd)
    fd.close()


    # 建立下载目录
    dir_name = "./images"
    if not os.path.exists(dir_name):
        os.mkdir(dir_name)

    cnt = 0
    for item in items:
        url = item[0] # 以'/'来分割字符串
        file_name = str(cnt) + ".jpg"
        cnt += 1
        response = requests.get(url, headers=headers) 
        # 保存
        with open(dir_name + "/" + file_name, 'wb') as f:
            f.write(response.content)  # 将图片写入到文件夹下保存
        info = "图片文件:    {0:25}{1}".format(file_name," 成功下载...")
        print(info)
    
    # print(items)
    return items
    


if __name__ == "__main__":
    # pass
    mySpider()

运行结果展示:
在这里插入图片描述

GUI4Spider.py

制作简易的tkinter GUI 图形化用户交互界面
  •  
from spider4taopiaopiao import mySpider
from tkinter import *
import time
from PIL import Image,ImageTk
import json

# sourcePath = "items.json"
# fs = open(sourcePath,"r",encoding='utf-8')
# items = json.load(fs)
# fs.close()


# print(len(items))
# print(items)
items = mySpider()
# 0图片链接   1电影名   2评分   3导演   4主演   5类型   6地区   7语言   8片长
infoMap = {
    0:"图片链接:",   1:"电影名:",   2:"评分:",   3:"导演:",
    4:"主演:",   5:"类型:",   6:"地区:",   7:"语言:",   8:"片长:"
}
current_rank = 1
total_rank = len(items)

root = Tk()
root.title("淘票票电影热映排行榜,更新时间:"+\
    time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
root.geometry('800x800')
root.iconbitmap("movie.ico")

def showPre():
    global current_rank,total_rank
    if current_rank <= 1:
        current_rank = 2
    current_rank -= 1
    print("显示前一部电影...",current_rank)
    labimgconfig()
    labInfoConfig()

def showNxt():
    global current_rank,total_rank
    if current_rank >= total_rank:
        current_rank = total_rank-1
    current_rank += 1
    print("显示后一部电影...",current_rank)
    labimgconfig()
    labInfoConfig()

def labimgconfig():
    filename = "images/" + str(current_rank-1) + ".jpg"
    global newImage 
    newImage = getImage(filename)
    labimg.config(image=newImage)

def getImage(filename):
    imageJPG = Image.open(filename)
    image = ImageTk.PhotoImage(imageJPG)
    return image

def labInfoConfig():
    info = items[current_rank-1]
    for i in range(len(labInfo)):
        labInfo[i].config(text=infoMap[i+1]+info[i+1])
    labRank.config(text="排名:#" +str(current_rank))


image = getImage("images/0.jpg")
labimg = Label(root) # 设置Widget控件显示的图像
labimg.config(image=image)
labimg.pack()        # 包装与定位组件

colors = ["Red","Orange","Yellow","Green","Blue","Violet","Purple","Chocolate"]
labInfo = []
for color in colors:
    labtemp = Label(root,bg=color,width=200,height=3,wraplength=1000)
    labtemp.pack()
    labInfo.append(labtemp)
labRank = Label(root,bg="Red",width=9,height=3,text="排名:#" +str(current_rank))
labRank.pack()

# labName = Label(root,bg="Red",width=50,height=2)
# labName.pack()
# labScore = Label(root,bg="Orange",width=50,height=2)
# labScore.pack()
# labDirector = Label(root,bg="Yellow",width=50,height=2)
# labDirector.pack()
# labActor = Label(root,bg="Green",width=50,height=2)
# labActor.pack()
# labType = Label(root,bg="Blue",width=50,height=2)
# labType.pack()
# labDistrict = Label(root,bg="Violet",width=50,height=2)
# labDistrict.pack()
# labLanguage = Label(root,bg="Purple",width=50,height=2)
# labLanguage.pack()
# labLength = Label(root,bg="Chocolate",width=50,height=2)
# labLength.pack()


btnPre = Button(root,width=15,height=5,text="显示前一个",command=showPre) 
btnNxt = Button(root,width=15,height=5,text="显示后一个",command=showNxt)
btnPre.pack(side=LEFT,anchor=S)
btnNxt.pack(side=RIGHT,anchor=S)
showPre()

root.mainloop()

运行结果如下:
在这里插入图片描述

利用Scrapy爬取1905电影网 本文将从以下几个方面讲解Scrapy爬虫的基本操作 Scrapy爬虫介绍 Scrapy安装 Scrapy实例——爬取1905电影网 相关资料 Scrapy 爬虫介绍Scrapy是Python开发的一个快速,高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据。Scrapy用途广泛,可以用于数据挖掘、监测和自动化测试。Scrapy吸引人的地方在于它是一个框架,任何人都可以根据 阅读详情

相关推荐

Python爬虫实战:爬取淘票票热映电影排行并用Tkinter展示GUI界面

在当今数据驱动的时代,网络爬虫技术已成为获取互联网信息的重要手段。本项目结合Python的爬虫技术与图形用户界面(GUI)设计,构建一个能够自动抓取热映电影排行数据并以可视化方式展示的桌面应用。通过使用requests与进行网页数据抓取,再结合Tkinter实现用户界面交互,项目不仅具备数据采集能力,还增强了用户体验。项目整体结构清晰,涵盖爬虫基础、页面解析、界面设计、事件交互、性能优化等多个核心模块。

weixin_42143092的博客 2123

python爬虫——爬取淘票票正在热映电影

今天正好学习了一下python的爬虫,觉得收获蛮大的,所以写一篇博客帮助想学习爬虫的伙伴们。 这里我就以一个简单地爬取淘票票正在热映电影为例,介绍一下一个爬虫的完整流程。 首先,话不多说,上干货——源代码 1 from bs4 import BeautifulSoup 2 import requests 3 import json 4 5 #伪装成浏览器请求 6 ...

weixin_30740581的博客 1130

【源代码】python爬取淘票票网站热映电影排行,以及tkinter显示GUI界面

源代码文件。利用python爬取淘票票网站热映电影排行,并利用tkinter实现GUI可视化图形用户界面

接单---毕设之豆瓣电影分析可视化系统基于tkinter界面requests爬虫实现

第一次写,先上一张成品图:

m0_48358490的博客 2140

用爬虫爬取豆瓣电影TOP250,并用PythonTkinter实现GUI展示与电影信息检索

用爬虫爬取豆瓣电影TOP250,并用PythonTkinter实现GUI展示与电影信息检索

Python 打造颜值评分应用(二):基于tkinter开发界面

首先描述一下需求: 在开始时,有按钮“选择文件”,点击后能自动打开文件夹选中图片文件,选中文件后,点击“确定”按钮,打开子界面,展示图片和颜值评分。具体如图所示(先说好,图片随便找的,可不是本人,我哪有那么丑,我可是当地吴彦祖,啊哈哈哈哈): OK,画饼充饥,饼已经画好了,下面是具体实现。 首先说第一个选择图片文件的界面怎么实现。 选择文件界面 这个比较简单。首先布置好条条框框: root = tk.Tk() root.title(GUI) fm1=tk.Frame(root) path = tk.StringVar() Ltop=tk.Label(fm1,text=请选择图片路径

【办公类-10】20220519Python电话号码本查询(字典的键和值对应查找)

【办公类-10】20220519Python电话号码本查询(字典的键和值对应查找)

reasonsummer的博客 2645

避坑指南:Winbond W25Q256JV QSPI Flash状态寄存器那些坑(含QE位不可改的解决方案)

本文深度解析Winbond W25Q256JV QSPI Flash状态寄存器的常见问题与解决方案,重点解决QE位不可修改、写保护区域异常等典型问题。通过实战代码示例和寄存器配置技巧,帮助开发者高效完成Flash读写测试与性能优化,避免常见设计陷阱。

ol7890123的博客 311

基于python的电影查询(json)

import requests import json def Movie_main(): city = input('请输入您要查询的城市:') url = 'http://api.map.baidu.com/telematics/v3/movie?qt=hot_movie&location=%s&ak=TueGDhCvwI6fOrQnLM0qmXxY9N0OkOiQ&out

alban_l的博客 1284

别再只调API了!深度拆解Dify文件上传的两种传参方式(sys.file vs. inputs.upload_file)

本文深度解析Dify平台文件上传的两种传参方式——sys.file与inputs.upload_file,详细对比其设计原理、技术实现及适用场景。通过代码示例和性能分析,帮助开发者在本地大模型应用中做出精准技术选型,提升文件处理效率与系统稳定性。

weixin_29063979的博客 272

机器学习预测材料性能:从特征工程到SHAP可解释性分析

机器学习在材料科学中的应用,核心在于将复杂的材料性能预测问题转化为数据驱动的建模任务。其基本原理是通过算法从历史数据中学习特征与目标属性之间的映射关系。这项技术的价值在于能够大幅加速新材料的发现与设计周期,降低传统“试错法”的高昂成本。在工程实践中,它广泛应用于预测如形成能、带隙、弹性模量以及居里温度等关键材料性能。具体到磁性材料领域,居里温度的准确预测对于永磁体和自旋电子器件设计至关重要。本项目深入探讨了如何利用特征工程从材料成分与结构中构建有效描述符,并借助SHAP这一可解释性工具,揭示模型决策背后的物

weixin_27155667的博客 659

python利用tkinter制作GUI界面,爬取淘票票国庆中秋双节时下热映电影

spider4taopiaopiao.py 爬取网站电影排行榜 import requests import re import os import time import json def mySpider(): # 伪装 用于可以伪装成浏览器。 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom

敲代码的小风 1245

电脑主板开机12步流程全解析:从按下电源键到BIOS启动的完整过程

本文深入解析了电脑主板从按下电源键到BIOS启动的完整12步流程,详细阐述了待机电路、主供电上电、CPU供电建立、时钟信号分发及复位链等关键硬件协同工作原理。通过剖析电脑主板的电路结构与芯片协作时序,帮助读者构建系统性的硬件故障诊断思维,精准定位开机故障。

weixin_29290963的博客 276

用python模拟《流浪地球》的木星引力弹弓效应

本文涉及影片内容,但算不上剧透。想看还未看的同学请谨慎阅读。春节档的几部电影里,《流浪地球》成为一匹黑马,刷爆微博和朋友圈,从最初不高的排片率,一跃上升到票房榜首。看过影片的人可能会有一个疑问,太阳系那么空旷,为什么地球在“流浪”的过程中,非要作死往木星上靠?这就牵涉到一个时常在影视作品中拿来做文章,实际在太空探测中很常见的一个概念:引力弹弓效应当一个飞行器飞过一个行星时,如果距离较近,就会受到行...

weixin_40190310的博客 697

从零构建知识图谱:本体工程与知识建模实战指南

本文是一份从零构建知识图谱的实战指南,重点阐述了知识建模与本体工程的核心地位。文章详细介绍了如何使用Protégé工具进行本体设计,包括定义领域、复用现有本体、构建类层次与属性约束,并讲解了如何利用D2RQ工具将关系数据库数据转换为RDF三元组,最终通过Apache Jena Fuseki搭建SPARQL端点进行知识查询与推理,让知识图谱真正“活”起来。

weixin_29057695的博客 577

Decoder如何工作、Transformer如何训练、以及exposure bias问题

1、结合图文描述Decoder中各个模块是什么,以及是如何工作的。2、transformer是如何训练的。3、exposure bias问题造成的原因及解决方法

m0_59113542的博客 3352

Python读取Excel文件统计演员参演电影

假设有个Excel 2007文件“电影导演演员.xlsx”,其中有三列分别为电影名称、导演和演员列表(同一个电影可能会有多个演员,每个演员姓名之间使用逗号分隔),现在要求统计每个演员的参演电影分别是哪些。

董付国的Python专栏 1万+

MAX96724解串器拨码配置实战:从COAX/GMSL2模式到IIC地址设定

本文详细解析了MAX96724解串器的拨码配置方法,涵盖电源管理模式、I2C地址设定及COAX/GMSL2视频传输模式。通过实战案例和故障排查技巧,帮助工程师快速掌握xcDeserializer4.0版本的配置要点,避免常见错误,提升车载摄像头和工业视觉系统的调试效率。

weixin_29243279的博客 589

python 电影导演演员信息 演员参演电影字典 关系中最好的n个演员

python演员关系分析 一、演员关系分析 实验目的: 熟悉Python扩展库openpyxl的安装与使用。 了解Execl文件结构与数据组织形式; 熟练掌握集合运算以及集合常用方法; 实验内容: 随机生成不少于20条的电影导演演员信息,并将其存放在excel文件“电影导演演员信息.xlsx”,其中内容按照:电影名称、导演、演员 三列分别存放。每部电影至少有四名演员参演,演员总数不超过15个。要求统计所有演员关系中最好的n个演员及其共同参演电影数量,其中n可以制定为大于或等于2的证书。这里关系好定义为共

SKPrimin的博客 5986

GibbsCAM软件二次开发:GibbsCAM软件API接口详解

API(Application Programming Interface,应用程序编程接口)是一种允许不同软件之间进行通信的接口。在GibbsCAM软件中,API提供了与外部程序交互的能力,使得开发者可以利用GibbsCAM的强大功能进行二次开发,定制化满足特定的制造需求。GibbsCAM的API主要基于.NET框架,使用C#或VB.NET等语言进行编程。在GibbsCAM软件中,通过API接口创建自定义几何形状是实现复杂零件设计和加工策略定制的关键步骤。

kkchenjj的博客 1503

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

python电影信息爬取

【代码】python电影信息爬取。

YINGXXX123的博客 1031

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

python tkinter实践之制作看视频小软件

利用tkinter制作一个可视化界面,能够进行选择播放接口,播放某链接的视频(支持优酷,腾讯等多平台),清空搜索框等操作。界面如下所示,代码也如下 import requests import re import tkinter as tk import webbrowser #第一步从qumail网址获取解码url url='http://www.qmaile.com/' headers={ ...

qq_34211618的博客 5865

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Python分析春节档七部电影的口碑和票房数据,并可视化显示

本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理。 以下文章来源于Python爬虫数据分析挖掘 ,作者李运辰 Python爬虫、数据分析、网站开发等案例教程视频免费在线观看 https://space.bilibili.com/523606542 前言 今年给大家爬取『大年初一』上映的几部热门数据(评分、时长、类型)以及相关网友评论等数据 对评分、时长、类型进行图表可视化 采用不同词云图案对七部电影『评论』词云秀!!!! 数据获取.

Python案例分享,B站视频教程:https://space.bilibili.com/523606542 4320

2-1 用Python尝试对豆瓣上的演员参演电影的电影名和上映日期进行抓取

2-1 用Python尝试对豆瓣上的演员参演电影的电影名和上映日期进行抓取 1 step1_actorsDate.py 2 # -*- coding: utf-8 -*- 3 import requests 4 import pandas as pd 5 import lxml.html 6 import time 7 from ...

u010505246的博客 1170

2-2 用Python爬取银河演员网上的演员参演电影的信息进行抓取

2-2 用Python爬取银河演员网上的演员参演电影的信息进行抓取 脚本中用到的actors_use.csv为之前从豆瓣上抓取的演员列表。 1 galaxyactors.py 2 # -*- coding: utf-8 -*- 3 #该脚本可以按照文件actors_use.csv中给出的演员的姓名 4 #对银河演员网http://www.8fkd...

u010505246的博客 648
上一篇: 在python tkinter窗口实现多线程秒表的两种方法
下一篇: 安卓手机上运行Python爬虫
Python_sn
博客等级 码龄6年 326粉丝 290原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址