Python编程:创意爱心表白代码集

在寻找一种特别的方式来表达你的爱意吗?使用Python编程,你可以创造出独一无二的爱心图案,为你的表白增添一份特别的浪漫。这里为你精选了六种不同风格的爱心表白代码,让你的创意和情感通过代码展现出来。

话不多说,咱直接上代码!

1. 紫色浪漫:心形表白

在这里插入图片描述

#1-1导入turtle模块进行设计
import turtle
import time
 
#1-2画心形圆弧
def hart_arc():
    for i in range(200):
        turtle.right(1)
        turtle.forward(2)
 
 
def move_pen_position(x, y):
    turtle.hideturtle()  # 隐藏画笔(先)
    turtle.up()  # 提笔
    turtle.goto(x, y)  # 移动画笔到指定起始坐标(窗口中心为0,0)
    turtle.down()  # 下笔
    turtle.showturtle()  # 显示画笔
 
 
love = "听闻小姐治家有方,鄙人余生愿闻其详?" #input("请输入表白话语:")
signature = "先生" #input("请签署你的名字:")
date= "" #input("请写上日期:")
 
if love == '':
    love = 'I Love You'
 
#1-3初始化
turtle.setup(width=800, height=500)  # 窗口(画布)大小
turtle.color('black', 'Pink')  # 画笔颜色
turtle.pensize(5)  # 画笔粗细
turtle.speed(100)  # 描绘速度
# 初始化画笔起始坐标
move_pen_position(x=0, y=-180)  # 移动画笔位
turtle.left(140)  # 向左旋转140度
 
turtle.begin_fill()  # 标记背景填充位置
 
#1-4画图和展示
turtle.forward(224)  # 向前移动画笔,长度为224
# 画爱心圆弧
hart_arc()  # 左侧圆弧
turtle.left(120)  # 调整画笔角度
hart_arc()  # 右侧圆弧
# 画心形直线( 右下方 )
turtle.forward(224)
 
turtle.end_fill()  # 标记背景填充结束位置
 
move_pen_position(x=70, y=160)  # 移动画笔位置
turtle.left(185)  # 向左旋转180度
turtle.circle(-110,185)  # 右侧圆弧
# 画心形直线( 右下方 )
#turtle.left(20)  # 向左旋转180度
turtle.forward(50)
move_pen_position(x=-180, y=-180)  # 移动画笔位置
turtle.left(180)  # 向左旋转140度
 
# 画心形直线( 左下方 )
turtle.forward(600)  # 向前移动画笔,长度为224
 
# 在心形中写上表白话语
move_pen_position(0,50)  # 表白语位置
turtle.hideturtle()  # 隐藏画笔
turtle.color('#CD5C5C', 'pink')  # 字体颜色
# font:设定字体、尺寸(电脑下存在的字体都可设置)  align:中心对齐
turtle.write(love, font=('Arial', 20, 'bold'), align="center")
 
# 签写署名和日期
if (signature != '') & (date != ''):
    turtle.color('red', 'pink')
    time.sleep(2)
    move_pen_position(220, -180)
    turtle.hideturtle()  # 隐藏画笔
    turtle.write(signature, font=('Arial', 20), align="center")
    move_pen_position(220, -220)
    turtle.hideturtle()  # 隐藏画笔
    turtle.write(date, font=('Arial', 20), align="center")
 
#1-5点击窗口关闭程序
window = turtle.Screen()
window.exitonclick()

2. 爱意满满:Love2 I Love You

在这里插入图片描述

import turtle as t
import math as mt

if __name__ == "__main__":
    t.screensize(800,600,'white')
    t.pensize(10)
    t.speed(10)
    #爱心1
    t.color('black','pink')
    t.begin_fill()
    for i in range(-90,90,5):
        x=mt.cos(mt.radians(i))
        y=float(pow(mt.cos(mt.radians(i)),2/3))+float(mt.sin(mt.radians(i)))
        t.penup()
        # print(int(x*50)+10,int(y*50)+10)
        t.goto(int(x*50)+50,int(y*50)+30)
        t.pendown()
        t.forward(1)
        t.penup()
        t.goto(-int(x*50)+50,int(y*50)+30)
        t.pendown()
        t.forward(1)
        t.penup()
    t.end_fill()
    #爱心2
    t.goto(0,10)
    t.penup()
    t.begin_fill()
    for i in range(0,360,5):
        r=60*(1-mt.sin(mt.radians(i)))
        t.penup()
        t.left(5)
        t.forward(r)
        t.pendown()
        t.forward(1)
        t.penup()
        t.backward(r+1)
        t.pendown()
    t.end_fill()
    #L
    t.penup()
    t.goto(-200,0)
    t.left(90)
    t.begin_fill()
    t.pendown()
    t.forward(100)
    t.right(90)
    t.forward(20)
    t.right(90)
    t.forward(80)
    t.left(90)
    t.forward(40)
    t.right(90)
    t.forward(20)
    t.right(90)
    t.forward(60)
    t.end_fill()
    #o
    t.penup()
    t.goto(-80,0)
    t.pendown()
    t.begin_fill()
    t.circle(-50)
    t.end_fill()
    t.penup()
    t.color('pink','black')
    t.begin_fill()
    t.goto(-80,20)
    t.pendown()
    t.circle(-30)
    t.end_fill()
    t.color('black','pink')
    #E
    t.penup()
    t.goto(120, 0)
    t.right(180)
    t.left(90)
    t.begin_fill()
    t.pendown()
    t.forward(100)#上
    t.right(90)
    t.forward(60)#横
    t.right(90)
    t.forward(20)#竖
    t.right(90)
    t.forward(40)#横
    t.left(90)
    t.forward(20)#竖
    t.left(90)
    t.forward(40)#横
    t.right(90)
    t.forward(20)
    t.right(90)
    t.forward(40)
    t.left(90)
    t.forward(20)
    t.left(90)
    t.forward(40)
    t.right(90)
    t.forward(20)
    t.right(90)
    t.forward(60)
    t.end_fill()

    t.mainloop()

3. 红色热情:心形与文字结合

在这里插入图片描述

import turtle as t





def face(x, y):           #脸

    t.setheading(-90)

    t.penup()

    t.goto(x, y)

    t.pendown()

    t.backward(15)   # 左脸

    t.circle(70,-80)



    t.setheading(80)   # 左耳

    t.circle(-150, 15)

    t.circle(-15, 180)

    t.setheading(-115)

    t.circle(-150, 13)

    t.setheading(10)



    t.circle(-100,10)



    t.setheading(70)    # 右耳

    t.circle(-150, 20)

    t.circle(-15, 180)

    t.circle(-150, 16)

    t.setheading(10)



    t.setheading(160)   # 右脸

    t.circle(60, -130)



    t.setheading(-75)

    t.forward(40)



def word(x, y):             # “如何骗人”

    t.pensize(2)

    t.pencolor("black")

    t.setheading(0)

    t.penup()

    t.goto(x, y)

    t.pendown()



    t.forward(10)   # “如”

    t.penup()

    t.setheading(90)

    t.forward(8)

    t.pendown()

    t.setheading(-120)

    t.forward(15)

    t.setheading(-45)

    t.forward(12)



    t.penup()

    t.setheading(80)

    t.forward(15)

    t.pendown()

    t.setheading(-125)

    t.forward(16)



    t.penup()

    t.setheading(42)

    t.forward(16)

    t.pendown()

    t.setheading(-90)

    t.forward(10)

    t.penup()

    t.backward(11)

    t.pendown()

    t.setheading(0)

    t.forward(8)

    t.setheading(-90)

    t.forward(10)

    t.penup()

    t.setheading(180)

    t.forward(8)

    t.pendown()

    t.setheading(0)

    t.forward(8)



    t.penup()        # “何”

    t.goto(x+7,y-18)

    t.pendown()

    t.setheading(-135)

    t.forward(13)



    t.penup()

    t.goto(x+5, y - 20)

    t.pendown()

    t.setheading(-90)

    t.forward(16)



    t.penup()

    t.goto(x+11, y-18)

    t.pendown()

    t.setheading(0)

    t.forward(13)



    t.penup()

    t.goto(x+12, y-22)

    t.pendown()

    t.setheading(-90)

    t.forward(8)



    t.penup()

    t.goto(x + 12, y - 22)

    t.pendown()

    t.setheading(0)

    t.forward(6)

    t.setheading(-90)

    t.forward(8)



    t.penup()

    t.goto(x + 11, y - 31)

    t.pendown()

    t.setheading(0)

    t.forward(6)



    t.penup()

    t.goto(x + 21, y - 19)

    t.pendown()

    t.setheading(-90)

    t.forward(18)

    t.setheading(145)

    t.forward(5)



    t.penup()           # “骗”

    t.goto(x + 40, y+3)

    t.pendown()

    t.setheading(0)

    t.forward(10)

    t.setheading(-90)

    t.forward(7)



    t.penup()

    t.goto(x + 45, y + 3)

    t.pendown()

    t.setheading(-90)

    t.forward(10)

    t.setheading(0)

    t.forward(7)

    t.setheading(-100)

    t.forward(10)

    t.setheading(145)

    t.forward(4)



    t.penup()

    t.goto(x+38, y-12)

    t.pendown()

    t.setheading(0)

    t.forward(11)



    t.penup()

    t.goto(x+57, y+9)

    t.pendown()

    t.setheading(-45)

    t.forward(4)



    t.penup()

    t.goto(x+54, y+3)

    t.pendown()

    t.setheading(0)

    t.forward(13)

    t.setheading(-90)

    t.forward(5)

    t.setheading(180)

    t.forward(12)



    t.penup()

    t.goto(x + 54, y + 3)

    t.pendown()

    t.setheading(90)

    t.circle(90,-10)



    t.penup()

    t.goto(x + 56, y-5)

    t.pendown()

    t.setheading(-90)

    t.forward(11)



    t.penup()

    t.goto(x + 56, y - 5)

    t.pendown()

    t.setheading(0)

    t.forward(13)

    t.setheading(-90)

    t.forward(12)

    t.setheading(145)

    t.forward(4)



    t.penup()

    t.goto(x + 56, y - 10)

    t.pendown()

    t.setheading(0)

    t.forward(13)



    t.penup()

    t.goto(x + 56, y - 10)

    t.pendown()

    t.setheading(0)

    t.forward(13)



    t.penup()

    t.goto(x + 60, y - 4)

    t.pendown()

    t.setheading(-90)

    t.forward(10)

    t.penup()

    t.goto(x + 64, y - 4)

    t.pendown()

    t.setheading(-90)

    t.forward(10)



    t.penup()          # “人”

    t.goto(x + 60, y - 19)

    t.pendown()

    t.setheading(70)

    t.circle(50, -30)



    t.penup()

    t.goto(x + 56, y - 27)

    t.pendown()

    t.setheading(130)

    t.circle(-50, -20)



def book(x,y):           #书

    t.setheading(-90)

    t.penup()

    t.goto(x, y)

    t.fillcolor("red")

    t.begin_fill()

    t.pendown()

    t.forward(60)

    t.setheading(0)

    t.circle(-100, 25)

    t.setheading(90)

    t.forward(59)

    t.setheading(-25)

    t.circle(-100, -25)

    t.penup()

    t.setheading(-14)

    t.forward(46)

    t.pendown()

    t.setheading(15)

    t.circle(-100, 25)

    t.setheading(-90)

    t.forward(58)

    t.setheading(-11)

    t.circle(-105, -25)

    t.end_fill()



def eyes(x, y):         # 五官

    t.setheading(-20)

    t.penup()

    t.goto(x, y)

    t.pendown()

    t.forward(10)



    t.setheading(0)

    t.penup()

    t.forward(10)

    t.pendown()

    t.setheading(20)

    t.forward(10)



    t.setheading(-160)

    t.penup()

    t.forward(50)

    t.pendown()

    t.setheading(0)

    t.forward(15)



    t.penup()

    t.forward(25)

    t.pendown()

    t.forward(18)



    t.setheading(-145)

    t.penup()

    t.forward(45)

    t.pendown()

    t.setheading(0)

    t.forward(10)



def cheek(x, y):          #腮红

    t.setheading(0)

    for i in range(1, 4):

        t.color("pink")

        t.pensize(4)

        t.penup()

        t.right(110)

        t.goto(x, y)

        t.pendown()

        t.forward(9)

        t.left(110)

        x += 9

    t.pencolor("black")



def hands(x,y):     # 小手手

    t.penup()

    t.goto(x, y)

    t.pendown()



    t.fillcolor("white")

    t.begin_fill()

    t.circle(10)

    t.end_fill()



    t.penup()

    t.setheading(5)

    t.forward(120)

    t.pendown()

    t.fillcolor("white")

    t.begin_fill()

    t.setheading(-165)

    t.forward(35)

    t.circle(10,180)

    t.forward(15)

    t.end_fill()





def heart(x,y,z):      # 爱心

    t.setheading(110)

    t.pensize(2)

    t.pencolor("black")

    t.penup()

    t.goto(x,y)

    t.pendown()

    t.fillcolor("red")



    t.begin_fill()     #左半边



    t.circle(50,180)

    t.circle(180,37)



    t.left(46)      #右半边

    t.circle(180,37)

    t.circle(50, 182)



    t.end_fill()



def main():

    """

        主函数

    """

    t.pensize(0)

    t.speed(6)

    face(-95, 55)

    eyes(-45, 110)

    cheek(-80, 80)

    cheek(0, 80)

    book(-110, 55)

    hands(-110,5)

    word(-100,35)

    heart(150,0,1)

    t.hideturtle()

    t.exitonclick()

if __name__ == "__main__":

    main()

4. 爱的箭矢:一箭穿心效果

在这里插入图片描述

import turtle as t

t.color('white','red')

t.begin_fill()

t.width(5)

t.left(135)

t.fd(100)

t.right(180)

t.circle(50,-180)

t.left(90)

t.circle(50,-180)

t.right(180)

t.fd(100)

t.pu()

t.goto(50,-30)

t.pd()

t.right(90)

t.fd(100)

t.right(180)

t.circle(50,-180)

t.left(90)

t.circle(50,-180)

t.right(180)

t.fd(100)

t.end_fill()

t.hideturtle()

t.pu()

t.goto(250,-70)

t.pd()

t.color('black')

t.width(5)

t.left(70)

t.fd(50)

t.fd(-50)

t.left(70)

t.fd(50)

t.fd(-50)

t.left(145)

t.fd(20)

t.left(145)

t.fd(50)

t.fd(-50)

t.left(70)

t.fd(50)

t.fd(-50)

t.left(145)

t.fd(20)

t.left(145)

t.fd(50)

t.fd(-50)

t.left(70)

t.fd(50)

t.fd(-50)

t.left(145)

t.width(3)

t.fd(220)

t.right(90)

t.pu()

t.fd(10)

t.pd()

t.left(90)

t.circle(10,180)

t.circle(10,-90)

t.right(90)

t.fd(-10)

t.pu()

t.fd(90)

t.left(90)

t.fd(10)

t.left(90)

t.pd()

t.circle(10,180)

t.circle(10,-90)

t.left(90)

t.fd(100)

t.begin_fill()

t.left(30)

t.fd(15)

t.right(35)

t.fd(50)

t.right(150)

t.fd(50)

t.right(62)

t.fd(25)

t.end_fill()

t.done()

5. 一箭穿心文字版

在这里插入图片描述

from turtle import *
import turtle
from tkinter import *
import subprocess
import os
import random as ran


def Circlemove(size):
    for i in range(200):
        right(1)
        forward(1 * size)


def Heart(x, y, size):
    setturtle(x, y)
    speed(0.6)
    color('red', 'pink')
    begin_fill()
    left(140)
    forward(111.65 * size)
    Circlemove(size)
    left(120)
    Circlemove(size)
    forward(111.65 * size)
    end_fill()
    penup()


def setturtle(x, y):
    penup()
    goto(x, y)
    pendown()


def Line():
    speed(0.6)
    pensize(10)
    setheading(0)
    setturtle(-300, 0)
    left(12)
    forward(210)
    setturtle(80, 80)
    forward(150)


def LineHead():
    pensize(1)
    speed(0.5)
    color('red', 'red')
    begin_fill()
    left(120)
    forward(20)
    right(150)
    forward(35)
    right(120)
    forward(35)
    right(150)
    forward(20)
    end_fill()


def SavePicture():
    ts = getscreen()
    ts.getcanvas().postscript(file="520.ps", colormode='color')
    window = turtle.Screen()
    window.exitonclick()


def main():
    Love_Words = ["我喜欢的样子,你都有。"]
    Love_Letter = ["有你陪伴的日子,真好。", "遇见你,此生甚幸。"]
    Random_Number = ran.randint(0, len(Love_Words) - 1)
    setup(800, 600, 0, 0)
    getscreen().tracer(30, 0)
    hideturtle()
    pensize(3)
    color('black', 'pink')
    Heart(0, -25, 0.75)
    home()
    Heart(-80, -50, 1)
    Line()
    LineHead()
    pencolor("purple")
    speed(0.6)
    j = 0
    for i in Love_Words[Random_Number]:
        j = j + 1
        setturtle(j * 25 - 250, -150 + ran.randint(-1, 1) * 7)
        write(i, font=("楷体", 25, "normal"))
    j = 0
    pencolor("purple")
    for i in Love_Letter:
        j = j + 1
        setturtle(-400, 275 - j * 27)
        write(i, font=("楷体", 25, "normal"))
    pencolor('black')
    SavePicture()


if __name__ == '__main__':
    main()

6. 爱心一行代码:简洁表白

在这里插入图片描述

print('\n'.join([''.join([('Love'[(x-y) % len('Love')] if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 <= 0 else ' ') for x in range(-30, 30)]) for y in range(30, -30, -1)]))
👇 源码资料获取 · 技术与交流 👇

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/889350.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

C++开发五子棋游戏案例详解

✅作者简介&#xff1a;2022年博客新星 第八。热爱国学的Java后端开发者&#xff0c;修心和技术同步精进。 &#x1f34e;个人主页&#xff1a;Java Fans的博客 &#x1f34a;个人信条&#xff1a;不迁怒&#xff0c;不贰过。小知识&#xff0c;大智慧。 &#x1f49e;当前专栏…

MSYS2+GCC 安装与应用保姆手册

msys2 提供可在Windows下使用 GCC 编译器&#xff1b;并且&#xff0c;借助 Linux 包管理功能&#xff0c;可轻松下载丰富的可在Windows下直接使用的 C/C 开发包&#xff0c;包括编译好的二进制包。 网络库asio、准标准库boost、zip解压缩、json格式处理、引擎 SDL……十八般兵…

图片美化SDK解决方案,赋能H5与小程序极致体验

无论是社交媒体分享、电商产品展示&#xff0c;还是个人日常生活的记录&#xff0c;一张经过精心美化的图片总能瞬间吸引眼球&#xff0c;传递出更加丰富和动人的信息。如何在不增加应用体积、不牺牲用户体验的前提下&#xff0c;为H5页面和小程序提供媲美原生APP的图片美化功能…

前端高频面试题2024/9/22(偏项目问题--通用后台管理系统)

文章目录 一.前端项目概述1.系统登录注册模块1.对注册的密码进行加密 &#xff08;使用加密中间件bcrypt.js&#xff09;2.登录成功后返回token3.前端登录页面有用到弹性布局&#xff0c;ref和reactive4.登录头像&#xff1a;文件上传 2.系统设置模块2.系统首页模块&#xff08…

Unity 从零开始的框架搭建1-2 事件的发布-订阅-取消的小优化及调用对象方法总结[半干货]

该文章专栏是向QFrameWork作者凉鞋老师学习总结得来&#xff0c;吃水不忘打井人&#xff0c;不胜感激 Unity 从零开始的框架搭建1-1 unity中对象调用的三种方式的优缺点分析【干货】-CSDN博客 原来 其实就是对上一节的事件发布订阅类的小优化&#xff0c;原来是这样子的 p…

【SEO】什么是SEO?

什么是SEO&#xff08;搜索引擎优化&#xff09;&#xff1f;为什么SEO对于⼀个⽹站⾄关重要&#xff1f; SEO 全称是搜索引擎优化&#xff08;Search Engine Optimization&#xff09; 因为我们目前开发的网址&#xff0c;需要人看到&#xff0c;除了通过宣传营销的方式展现…

计算机毕业设计 校内跑腿业务系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍&#xff1a;✌从事软件开发10年之余&#xff0c;专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精…

Qt操作主/从视图及XML——实例:汽车管理系统

目录 1. 主界面布局2.连接数据库3.主/从视图应用 1. 主界面布局 先创建一个QMainwindow&#xff0c;不带设计界面 #ifndef MAINWINDOW_H #define MAINWINDOW_H#include <QMainWindow> #include <QGroupBox> #include <QTableView> #include <QListWidg…

【环境搭建】MAC M1安装ElasticSearch

STEP1 官网下载ES Download Elasticsearch | Elastic&#xff0c;下载mac m1对应版本的es STEP2 进入bin文件夹&#xff0c;执行./elasticSearch 浏览器输入 127.0.0.1:9200 STEP 3 下载对应Kibana版本&#xff0c;Download Kibana Free | Get Started Now | Elastic 出现报错…

Linux驱动开发(速记版)--单总线

第124章 单总线简介 124.1 单总线概述 单总线是一种串行通信协议&#xff0c;由Dallas Semiconductor开发&#xff0c;特点是用一根信号线实现双向数据传输和时钟同步&#xff0c;节省IO口且结构简单。 它广泛应用于传感器、存储器等。 硬件包括信号线、上拉电阻、设备和处理器…

高亚科技助力优巨新材,打造高效数字化研发项目管理平台

近日&#xff0c;中国企业管理软件资深服务商高亚科技与广东优巨先进新材料股份有限公司&#xff08;以下简称“优巨新材”&#xff09;正式签署合作协议&#xff0c;共同推进产品研发管理数字化升级。此次合作的主要目标是通过8Manage PM项目管理系统&#xff0c;提升优巨新材…

现货黄金价格走势图策略分析 先看“势”

在现货黄金投资市场&#xff0c;对金价走势图的趋势进行分析&#xff0c;是投资者做出明智决策的关键步骤。通过有效的趋势分析&#xff0c;投资者可以更好地预测市场的走向&#xff0c;从而制定相应的交易策略。本文将详细介绍如何分析金价的趋势&#xff0c;并探讨这种分析方…

QStandardItemModel的role

QStandardItemModel定义了一些标准的角色&#xff0c;而QAbstractItemModel允许自定义角色。以下是一些常见的数据角色&#xff1a;1. **Qt::DisplayRole**&#xff1a;这是最基本的角色&#xff0c;用于显示在视图中的文本。当一个单元格被绘制时&#xff0c;通常会查询这个角…

鸿蒙next开发者第一课02.DevEcoStudio的使用-习题

【习题】DevEco Studio的使用 通过/及格分80/ 满分100 判断题 1. 如果代码中涉及到一些网络、数据库、传感器等功能的开发&#xff0c;均可使用预览器进行预览。F 正确(True)错误(False) 预览器不能进行传感器等特殊功能的开发,需要使用真机开发 2. module.json5文件中的…

【大模型理论篇】精简循环序列模型(minGRU/minLSTM)性能堪比Transformer以及对循环神经网络的回顾

1. 语言模型之精简RNN结构 近期关注到&#xff0c;Yoshua Bengio发布了一篇论文《Were RNNs All We Needed?》&#xff0c;提出简化版RNN&#xff08;minLSTM和minGRU&#xff09;。该工作的初始缘由&#xff1a;Transformer 在序列长度方面的扩展性限制重新引发了对可在训练期…

消费者Rebalance机制

优质博文&#xff1a;IT-BLOG-CN 一、消费者Rebalance机制 在Apache Kafka中&#xff0c;消费者组 Consumer Group会在以下几种情况下发生重新平衡Rebalance&#xff1a; 【1】消费者加入或离开消费者组&#xff1a; 当一个新的消费者加入消费者组或一个现有的消费者离开消费…

若依项目搭建(黑马经验)

欢迎你搜索和了解到若依&#xff0c;这个项目是从黑马课程的一个实践&#xff0c;更多的项目经历和平台搭建期待着我们的共同学习&#xff01; 关于若依 若依是一套全部开源的快速开发平台&#xff0c;毫无保留给个人及企业免费使用。 前端采用Vue、Element UI。后端采用Sprin…

使用Pytorch+Numpy+Matplotlib实现手写字体分类和图像显示

文章目录 1.引用2.内置图片数据集加载3.处理为batch类型4.设置运行设备5.查看数据6.绘图查看数据图片(1)不显示图片标签(2)打印图片标签(3)图片显示标签 7.定义卷积函数8.卷积实例化、损失函数、优化器9.训练和测试损失、正确率(1)训练(2)测试(3)循环(4)损失和正确率曲线(5)输出…

Spark_累加器

分布式共享只写变量 实现原理&#xff1a;  累加器用来把Executor端变量信息聚合到Driver端&#xff0c;在Driver程序中定义的变量&#xff0c;在Executor端的每个Task都会得到这个变量的一份新的副本&#xff0c;每个task更新这些副本的值后&#xff0c;传回Driver端进行mer…

执行node.js获取本机Ip命令,报:Error: Cannot find module ‘ip‘错误

Error: Cannot find module ip是由于没有改模块的依赖包&#xff0c;需要进行安装&#xff0c;以管理员的身份打开命令行&#xff0c;执行npm install ip 获取当前电脑的ip地址 方法一&#xff1a; const ip require("ip")/*** 1:获取当前电脑的ip地址*/ console.…