跳至主要內容
JiaBao.Huang

JiaBao.Huang

“I love the people I photograph”

13-使用 Excel 画像素画

1. Excel 和图片类似

Excel 文件,单元格支持编辑内容和设置背景色。

一张图片,都是由密密麻麻的像素组成,且每个像素都是一个 rgb 的颜色值。

那是否可以读取图片每个像素的颜色,填充到 Excel 中,就可以做到 Excel 中画图。

这么想,是可以的。理论上也是可行的,那接下来就开始写代码。

2. 打开文件和图片

第一步,导入所需库,分别是 xlsxwriter 和图片的 Image 库。使用 xlsxwriter 的理由,是 xls 内容有限,图片的像素可是很多的,所以最好是使用 xlsx 格式。


AI悦创原创...大约 4 分钟Python 办公自动化Python 办公自动化
模块二:条件和循环

1. if-else 语句

1.1 if 语句

if 语句是一个条件语句,当条件为真时执行一段代码。

if 语句的一般形式是:

if (判断条件)
{
    // 当条件为真时,执行该语句
}

AI悦创原创...大约 11 分钟C#教程C#教程
Python Dateutil 库教程:日期解析、时区处理和日期运算入门指南

你好,我是悦创。

dateutil 是一个强大的 Python 库,用于处理日期和时间。这个库提供了许多功能,可以帮助你解析日期、处理时区、计算日期差异等等。以下是一些基础知识和常见用法的介绍,可以帮助你入门使用 dateutil

1. 安装

首先,你需要安装 dateutil 库。如果你还没有安装,可以使用 pip 来安装:

pip install python-dateutil

AI悦创原创...大约 2 分钟
COMP1005/5005 - Practical Test 2
  • Within your work area, create a PracTest2 directory to work in.
  • Run a web browser in the Virtual Machine and download the code file from Blackboard/Assessments and put it in the PracTest2 directory.
  • Edit as needed to get it running (drawing a line plot)
  • Then complete the four tasks below - one mark for each task

AI悦创原创...大约 3 分钟
Lab Participation 8

You have started to grow bored of the battleship game that you developed over the last week. You decided you want to spice it up a notch. You decide you want to allow the user to make their own ships and choose where they place it on the board, as well as display the board when firing missiles.


AI悦创原创...大约 6 分钟
数据结构
  1. 设二叉树 bt 的一种存储结构如表 7.3 所示。其中 bt 为树根结点指针,lchild、rchild 分别为结点的左、右孩子指针域,在这里使用结点编号作为指针域值,0表示指针域值为空;data 为结点的数据域。请完成下列各题:

(1)画出二叉树 bt 的树形表示。

(2)写出按先序、中序和后序遍历二叉树 bt 所得到的结点序列。

(3)画出二叉树 bt 的后序线索树(不带头结点)。

1 2 3 4 5 6 7 8 9 10
lchild 0 0 2 3 7 5 8 0 10 1
data j h f d b a c e g i
rchild 0 0 0 9 4 0 0 0 0 0

AI悦创原创...大约 4 分钟
02|所有权(上):Rust是如何管理程序中的资源的?

你好,我是悦创。

今天我们来讲讲 Rust 语言设计的出发点——所有权,它也是 Rust 的精髓所在。

在第一节课中,我们了解了 Rust 语言里的值有两大类:一类是固定内存长度(简称固定尺寸)的值,比如 i32、u32、由固定尺寸的类型组成的结构体等;另一类是不固定内存长度(简称非固定尺寸)的值,比如字符串 String。这两种值的本质特征完全不一样。而怎么处理这两种值的差异,往往是语言设计的差异性所在。

就拿数字类型来说,C、C++、Java 这些语言就明确定义了数字类型会占用内存中的几个字节,比如 8 位,也就是一个字节,16 位,也就是两个字节。而 JavaScript 这种语言,就完全屏蔽了底层的细节,统一用一个 Number 表示数字。Python 则给出了 int 整数、float 浮点、complex 复数三种数字类型。


AI悦创原创...大约 4 分钟数据分析一对一辅导数据分析一对一教学Rust 语言从入门到实战留学生作业辅导数据分析一对一辅导数据分析一对一教学Rust 语言从入门到实战留学生作业辅导
00-New project

AI悦创原创...大约 5 分钟Python notebookPython 1v1
TicTacToe Code

你好,我是悦创。

下面的是井字棋的代码:

欢迎关注我公众号:AI悦创,有更多更好玩的等你发现!

公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQ

方法二:微信:Jiabcdefh


AI悦创原创...大约 6 分钟
Lab Participation 7

Checkpoint 1: Implement Simplified Battleship Game (2pt)

Let's do some more coding! Your task is to create a simplified version of the Battleship game (What is Battleship Game?) using object-oriented programming (OOP) principles. In this game, you'll work with a 5x5 2D list representing the game board and 3 ships placed on the board. The objective is for the player to guess the ships' locations correctly within 10 attempts.


AI悦创原创...大约 7 分钟
CUH403CMD OO Programming

Review this week’s lecture material and complete the following tasks:

TASK 1

Consider the snippet of code below (this is related to the questions 1-3 below):

public class Person
{
    public void Walk()
    {
        Console.WriteLine("This is a Person walking");
    }
}

public class Student : Person
{
    public void Walk()
    {
        Console.WriteLine("This is a Student walking");
    }
}

public class Teacher : Person
{
    public void Walk()
    {
        Console.WriteLine("This is a Teacher walking");
    }
}

AI悦创原创...大约 6 分钟
不同仓库的自动化部署

你好,我是悦创。

不想直接公开源代码,想要利用私有仓库,部署到公开的 GitHub Pages 仓库。

1. 同账号部署推送

1.1 生成部署用的 SSH KEY

输入自定义名称,避免覆盖默认的 ssh 文件,影响 GitHub 原有的 SSH 授权。

比如:id_github_deploy_to_blog & id_github_deploy_to_blog.pub

ssh-keygen -t ed25519 -C "id_github_deploy_to_blog"

AI悦创原创...大约 2 分钟
考试

AI悦创原创...大约 1 分钟
模块一:基本概念

1. 什么是 C#

1.1 欢迎学习C#

C# 是一种优雅的面向对象语言,使开发人员能够构建在 .NET Framework 上运行的各种安全和强大的应用程序。

您可以使用 C# 创建 Windows 应用程序,Web 服务,移动应用程序,客户端 - 服务器应用程序,数据库应用程序等等。

【单选题】C# 应用程序运行在?

A. JAVA 环境

B. 在 .NET Framework 环境✅

C. 只能在 Linux 环境


AI悦创原创...大约 19 分钟C#教程C#教程
每节课学习目标和知识点

1. 环境搭建及其基础使用「2024年03月30日」

1.1 所需的 Python 环境


AI悦创原创...大约 2 分钟
25-红烧肉

1. 食材

食材 重量
猪五花肉 500g
大葱 10g
4瓣
10g
八角 2颗
干辣椒 2根
香叶 3g
冰糖 100g
桂皮 3块
1茶匙
酱油 1汤匙
料酒 1汤匙

AI悦创原创...大约 1 分钟程序员的私房菜