Linux shell编程学习笔记80:gzip命令——让文件瘦身

news2024/9/20 9:36:41

0 引言

Linux shell编程学习笔记76:tar命令——快照 & 备份(上)-CSDN博客

Linux shell编程学习笔记77:tar命令——快照 & 备份(下)_linux 系统快照-CSDN博客 

Linux shell编程学习笔记78:cpio命令——文件和目录归档工具(上)-CSDN博客

Linux shell编程学习笔记79:cpio命令——文件和目录归档工具(下)-CSDN博客

中,我们分别介绍了用于文件和目录归档的tar和cpio命令,为了缩小归档文件的体积,我们还可以使用压缩软件对归档文件进行压缩。

在Windows系统中,我们常用的压缩软件有WinRAR、7-Zip、WinZip、PeaZip、Bandizip等。

在Linux系统中,常用的压缩软件有gzip,plzip、p7zip、pbzip2、ebzip等。

今天我们重点研究gzip。

1 gzip 的功能,帮助信息,格式,选项和参数说明

1.1 gzip 的功能

gzip 命令是 Linux 中流行的压缩工具,用于减小文件大小,同时保留其原始内容。它是 GNU Core Utilities 包的一部分,几乎在所有 Linux 发行版上都可用。 

1.2 gzip 的帮助信息

我们可以使用 gzip -h 命令获取帮助信息。

1.2.1 bash中的gzip帮助信息

[purpleendurer @ bash ~] gzip
gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
[purpleendurer @ bash ~] gzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).

Mandatory arguments to long options are mandatory for short options too.

  -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
    --rsyncable   Make rsync-friendly archive

With no FILE, or when FILE is -, read standard input.

Report bugs to <bug-gzip@gnu.org>.
[purpleendurer @ bash ~] 

 1.2.2 银河麒麟(kylin)系统中的gzip帮助信息

[purpleendurer @ kylin ~] gzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).

Mandatory arguments to long options are mandatory for short options too.

  -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -k, --keep        keep (don't delete) input files
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
  --rsyncable       Make rsync-friendly archive

With no FILE, or when FILE is -, read standard input.

Report bugs to <bug-gzip@gnu.org>.
[purpleendurer @ kylin ~] 

 

1.3 gzip 的命令格式

gzip [选项]... [文件]...

1.4 gzip 的选项和参数说明

1.4.1 gzip的选项

选项说明备注
-c, --stdout写入标准输出,保持原始文件不变
-d, --decompress解压缩
-f, --force强制覆盖输出文件并压缩链接
-h, --help提供此帮助信息
-k, --keep保留(不删除)输入文件

不是所有版本的gzip都支持此参数

已知1.5不支持,1.6支持

-l, --list列出压缩文件内容
-L, --license显示软件许可证
-n, --no-name不保存或恢复原始名称和时间戳
-N, --name保存或恢复原始名称和时间戳
-q, --quiet抑制所有警告
-r、--recursive对目录递归操作
-S, --suffix=SUF在压缩文件上使用后缀 SUF
-t, --test测试压缩文件的完整性建议同时指定-v选项
-v, --verbose详细模式,显示详细的压缩或解压缩过程
-V、--version显示版本号
-1, --fast压缩速度更快
-9, --best压缩得更好
--rsyncable制作 rsync 友好的存档

1.4.2 gzip的参数

文件:表示要压缩或解压缩的一个或多个文件。 

2 gzip使用实例

2.1 创建演示文件和目录

我们使用 echo 命令和输出重定向创建文件f1.txt 和 f2.txt,使用mkdir命令创建目录d1,再使用 echo 命令和输出重定向在目录d1下面创建文件fa.txt 和 fb.txt
 

[purpleendurer @ bash ~ ] echo "f1" > f1.txt
[purpleendurer @ bash ~ ] echo "f2" > f2.txt
[purpleendurer @ bash ~ ] mkdir d1
[purpleendurer @ bash ~ ] echo "d1fa" > d1/fa.txt
[purpleendurer @ bash ~ ] echo "d1fb" > d1/fb.txt
[purpleendurer @ bash ~ ] ls -R
.:
Code  d1  f1.txt  f2.txt

./Code:

./d1:
fa.txt  fb.txt
[purpleendurer @ bash ~ ] 

 

2.2 压缩单个文件

2.2.1 压缩单个文件后删除源文件  

例如:使用gzip压缩当前目录下文件f1.txt的命令 :gzip f1.txt 

[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt  f2.txt
[purpleendurer @ bash ~ ] gzip f1.txt
[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt.gz  f2.txt
[purpleendurer @ bash ~ ] 

执行压缩命令后,我们会发现在当前目录下,被压缩的源文件f1.txt不见了,多了一个压缩后的目标文件 f1.txt.gz。

注意:在默认情况下,gzip压缩指定的文件,并为它加上 .gz 扩展名。源文件会被删除。 

2.2.2 压缩单个文件后保留源文件  

如果我们希望压缩文件后仍然保留源文件,该如何操作呢?

例如使用gzip压缩当前目录下文件f2.txt,压缩后不删除f2.tx

如果我们使用的gzip支持-k 选项,那么可以使用 -k 选项,命令为 :

gzip -k f2.txt 

如果我们使用的gzip不支持-k 选项,那么可以使用-c选项结合输出重定向来操作,命令为:

gzip -c f2.txt > f2.txt.gz

[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt.gz  f2.txt
[purpleendurer @ bash ~ ] gzip -k f2.txt
gzip: invalid option -- 'k'
Try `gzip --help' for more information.
[purpleendurer @ bash ~ ] gzip -c f2.txt > f2.txt.gz
gzip: f2.txt : No such file or directory
[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt.gz  f2.txt  f2.txt.gz
[purpleendurer @ bash ~ ] 

在上面的操作中,我们先尝试了命令: gzip -k f2.txt ,但是很不幸的是,我们使用的gzip不支持-k选项。

接着我们尝试了命令:gzip -c f2.txt > f2.txt.gz,虽然我们收到了出错提示信息:

gzip: f2.txt : No such file or directory

但是,我们使用ls命令会发现压缩文件f2.txt.gz。

要想避免收到上面所说的出错提示信息。

我们可以使用命令:

gzip  < f1.txt > f2.txt.gz

[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt  f2.txt
[purpleendurer @ bash ~ ] gzip  < f1.txt > f2.txt.gz
[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt  f2.txt  f2.txt.gz
[purpleendurer @ bash ~ ] 

2.3 压缩多个文件

压缩当前目录下的文件f1.txt f2.txt,命令为:

gzip f1.txt f2.txt

[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt  f2.txt  f2.txt.gz
[purpleendurer @ bash ~ ] gzip f1.txt f2.txt
gzip: f2.txt.gz already exists; do you wish to overwrite (y or n)? y
[purpleendurer @ bash ~ ] ls
Code  d1  f1.txt.gz  f2.txt.gz
[purpleendurer @ bash ~ ] 

在执行压缩命令的过程中,由于当前目录下已经存在文件f2.txt.gz,所以会提示是否覆盖该文件。

2.4 递归压缩目录树下的文件

为了实现递归压缩,我们要指定 -r 选项。

为了演示效果,我们在目录d1下再创建目录d2,在目录d2下创建文件fc.txt和fd.txt

[purpleendurer @ bash ~ ] mkdir d1/d2
[purpleendurer @ bash ~ ] echo "d2fc" > d1/d2/fc.txt
[purpleendurer @ bash ~ ] echo "d2fd" > d1/d2/fd.txt
[purpleendurer @ bash ~ ] ls -R
.:
Code  d1  f1.txt  f2.txt

./Code:

./d1:
d2  fa.txt  fb.txt

./d1/d2:
fc.txt  fd.txt
[purpleendurer @ bash ~ ] 

然后我们将目录d1及子目录下的文件进行压缩

[purpleendurer @ bash ~ ] ls -R
.:
Code  d1  f1.txt  f2.txt

./Code:

./d1:
d2  fa.txt  fb.txt

./d1/d2:
fc.txt  fd.txt
[purpleendurer @ bash ~ ] gzip -rv d1
d1/d2/fd.txt:   -40.0% -- replaced with d1/d2/fd.txt.gz
d1/d2/fc.txt:   -40.0% -- replaced with d1/d2/fc.txt.gz
d1/fb.txt:      -40.0% -- replaced with d1/fb.txt.gz
d1/fa.txt:      -40.0% -- replaced with d1/fa.txt.gz
[purpleendurer @ bash ~ ] ls -R
.:
Code  d1  f1.txt  f2.txt

./Code:

./d1:
d2  fa.txt.gz  fb.txt.gz

./d1/d2:
fc.txt.gz  fd.txt.gz
[purpleendurer @ bash ~ ] 

为了更好地看到命令执行的过程和效果,我们指定了-v选项。

2.4 指定压缩速度

我们可以为gzip指定一个压缩速度,其速度范围值为1——9。

1 是最快的压缩,压缩率最低

9 是最慢的压缩,压缩率最高

默认是 6

2.4.1 汉字

我们先拿汉字试一下。

[purpleendurer @ bash ~ ] echo "LZ77 的基本原理:LZ77 以经常出现的字母组合(或较长的字符串)构建字典中的数据项,并且使用较短的数字(或符号)编码来代替比较复杂的数据 项。数据压缩时,将从待压缩数据中读入的源数据与字典中的数据项进行匹配,从中检索出相应的代码并输出。从而实现数据的压缩。" > f3.txt
[purpleendurer @ bash ~ ] gzip -1 -cv < f3.txt > f3-1.gz
 29.6%
[purpleendurer @ bash ~ ] gzip -4 -cv < f3.txt > f3-4.gz
 29.6%
[purpleendurer @ bash ~ ] gzip -9 -cv < f3.txt > f3-9.gz
 29.6%
[purpleendurer @ bash ~ ] gzip -cv < f3.txt > f3-9.gz
 29.6%
[purpleendurer @ bash ~ ] 

 

我们先把一段汉字存放在文件 f3.txt中,然后分别指定压缩速度 1、4、9和默认(6)来进行压缩。

从命令执行信息来看,压缩率没有差别。 

2.4.2 英文

我们再用常用英文单词试一下:

[purpleendurer @ bash ~ ] echo "I, you, he, she, it, we, they,be, have, do, go, make, see, take, get, give,person, time, day, year, way, man, woman, child, government, company,good, bad, big, little, new, old, happy, sad, beautiful, ugly,very, really, so, too, then, now, well, just, also, still,a, an, the,in, on, at, with, for, about, from, over, under, between,and, but, or, so, because, if, when, while, although, before, after,one, two, three, four, five, ten, hundred, thousand, million,hello, goodbye, please, thank you, sorry, excuse me, yes, no,I, you, he, she, it, we, they,be, have, do, go, make, see, take, get, give,person, time, day, year, way, man, woman, child, government, company,good, bad, big, little, new, old, happy, sad, beautiful, ugly,very, really, so, too, then, now, well, just, also, still,a, an, the,in, on, at, with, for, about, from, over, under, between,and, but, or, so, because, if, when, while, although, before, after,one, two, three, four, five, ten, hundred, thousand, million,hello, goodbye, please, thank you, sorry, excuse me, yes, no" > f4.txt
[purpleendurer @ bash ~ ] gzip -1 -cv < f4.txt > f4-1.gz
 70.7%
[purpleendurer @ bash ~ ] gzip -4 -cv < f4.txt > f4-4.gz
 71.0%
[purpleendurer @ bash ~ ] gzip -9 -cv < f4.txt > f4-9.gz
 71.0%
[purpleendurer @ bash ~ ] gzip -cv < f4.txt > f4-9.gz
 71.0%
[purpleendurer @ bash ~ ] 

我们先把常用英文单词存放在文件 f4.txt中,然后分别指定压缩速度 1、4、9和默认(6)来进行压缩。

从4开始,压缩率没有变化。所以一般使用默认(6)就可以了。

 2.5 测试压缩文件的完整性

我们可以使用选项-t或 --test来测试压缩文件的完整性。

例如:测试文件f3.txt.gz的完整性

[purpleendurer @ bash ~ ] gzip -cv < f3.txt > f3.txt.gz
 29.6%
[purpleendurer @ bash ~ ] gzip -t f3.txt.gz
[purpleendurer @ bash ~ ] gzip -tv f3.txt.gz
f3.txt.gz:       OK
[purpleendurer @ bash ~ ] 

 

可以看到, 执行命令:gzip -t f3.txt.gz 没反馈信息。

执行命令 gzip -tv f3.txt.gz 才看到反馈信息:

f3.txt.gz:       OK

注意:为了看到测试结果,建议同时指定-v选项。

2.6 查看压缩文件的详细信息

我们可以指定 -l 选项可以查看 .gz 文件的详细信息。

例如,查看f3.txt.gz的详细信息

[purpleendurer @ bash ~ ] gzip -l f3.txt.gz
         compressed        uncompressed  ratio uncompressed_name
                279                 371  29.6% f3.txt
[purpleendurer @ bash ~ ] 

2.7 解压文件

我们可以使用选项 -d 或--decompress 来对压缩文件进行 解压缩。

例如,对压缩文件 f3.txt.gz 进行 解压缩

[purpleendurer @ bash ~ ] ls
Code  f3-1.gz  f3-4.gz  f3-9.gz  f3.txt
[purpleendurer @ bash ~ ] gzip -c < f3.txt >  f3.txt.gz
[purpleendurer @ bash ~ ] ls
Code  f3-1.gz  f3-4.gz  f3-9.gz  f3.txt  f3.txt.gz
[purpleendurer @ bash ~ ] gzip -dv f3.txt.gz
gzip: f3.txt already exists; do you wish to overwrite (y or n)? n
        not overwritten
[purpleendurer @ bash ~ ] gzip -dfv f3.txt.gz
f3.txt.gz:       29.6% -- replaced with f3.txt
[purpleendurer @ bash ~ ] ls
Code  f3-1.gz  f3-4.gz  f3-9.gz  f3.txt
[purpleendurer @ bash ~ ] 

 

我们执行命令gzip -dv f3.txt.gz时,由于当前目录中存在文件f3.txt,会要求我们确定是否覆盖原有文件:

gzip: f3.txt already exists; do you wish to overwrite (y or n)? 

我们输入n后,反馈信息:

        not overwritten

没有覆盖原有文件。

如果我们不想接收和处理是否覆盖原有文件的信息,我们可以使用 -f选项强制覆盖原有文件。

所以我们执行命令 gzip -dfv f3.txt.gz 时 会直接覆盖原有文件f3.txt:

f3.txt.gz:       29.6% -- replaced with f3.txt 

2.8 查看版本信息

 我们可以使用-V选项查看当前使用的gzip版本信息。

2.8.1 测试用的bash中的gzip版本信息

[purpleendurer @ bash ~ ] gzip -V
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.
[purpleendurer @ bash ~ ] 

 

2.8.2 银河麒麟(kylin)系统中的gzip版本信息

[purpleendurer @ kylin ~] gzip -v
gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
[purpleendurer @ kylin ~] gzip -V
gzip 1.6
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.
[purpleendurer @ kylin ~] 

 

看来gzip的1.5版本不支持-k选项,而1.6版本支持-k选项。

2.9 查看软件许可证信息

我们可以使用-L 或 --license 选项 查看软件许可证信息。

2.9.1 测试用的bash中的gzip软件许可证信息

[purpleendurer @ bash ~ ] gzip -L
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
[purpleendurer @ bash ~ ] 

显示的信息跟版本信息相似。

如果我们同时查看gzip版本和软件许可证信息会如何显示呢?

[purpleendurer @ bash ~ ] gzip -VL
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.
[purpleendurer @ bash ~ ] 

 

显示的是软件许可证信息。

2.9.2 银河麒麟(kylin)系统中的gzipgzip软件许可证信息

[purpleendurer @ kylin ~] gzip -L
gzip 1.6
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
[purpleendurer @ kylin ~] 

3  LZ77编码

gzip 使用 LZ77  编码来压缩和解压文件。

LZ 编码由以色列研究者 Jacob Ziv 和 Abraham Lempel 提出,是无损压缩的核心思想。LZ 是一个系列的算法,而其中最基本的就是两人在 1977年所发表的论文《A Universal Algorithm for Sequential Compression》 中提出的 LZ77 算法。

LZ77的核心思想:利用数据的重复结构信息来进行数据压缩。

而Huffman等基于统计的数据压缩编码需要先对数据进行字符频率统计,然后进行压缩。

LZ77 的基本原理:LZ77 以经常出现的字母组合(或较长的字符串)构建字典中的数据项,并且使用较短的数字(或符号)编码来代替比较复杂的数据项。数据压缩时,将从待压缩数据中读入的源数据与字典中的数据项进行匹配,从中检索出相应的代码并输出。从而实现数据的压缩。

LZ77 编码是一种基于字典及滑动窗口的无损压缩技术,广泛应用于通信传输。

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

ai绘画文生图怎么制作?2024教你快速进行ai绘画

ai绘画文生图怎么制作&#xff1f;2024教你快速进行ai绘画 AI绘画技术的迅速发展&#xff0c;使得用户只需输入文本描述&#xff0c;就能生成符合要求的图像&#xff0c;这种“文生图”&#xff08;Text-to-Image&#xff09;功能使得绘画和创作变得简单、高效。以下是5款帮助…

Git提交有乱码

服务器提交记录如图 可知application.properties中文注释拉黄线 &#xff0c;提示Unsupported characters for the charset ISO-8859-1 打开settings - Editor - File Encodings 因为我们项目的其他文件都是UTF-8&#xff0c;所以&#xff0c;我们将默认值都改成UTF-8 然后…

【原创】java+springboot+mysql鲜花商城(花店)系统设计与实现

个人主页&#xff1a;程序猿小小杨 个人简介&#xff1a;从事开发多年&#xff0c;Java、Php、Python、前端开发均有涉猎 博客内容&#xff1a;Java项目实战、项目演示、技术分享 文末有作者名片&#xff0c;希望和大家一起共同进步&#xff0c;你只管努力&#xff0c;剩下的交…

用于遥感深度学习的7种高光谱遥感图像和标签

数据介绍 此数据集来自于GIC(GRUPO INTELIGENCIA COMPUTACIONAL )官网 直达链接&#xff0c;采用MATLAB存储为矩阵形式&#xff0c;数据集后缀为.mat形式。每一个数据分为原始图像数据和标签数据&#xff0c;标签对应码请参考官网。注&#xff1a;此数据为公开数据&#xff0c…

20240915 每日AI必读资讯

国家网信办发布《人工智能生成合成内容标识办法&#xff08;征求意见稿&#xff09;》 - 要求所有的AI生成内容都要打标&#xff0c;包括文字、图像、视频、音频… - 文本内容要插入标识符提醒&#xff0c;音频内容要在里面插入提示音 - 对创作者不太友好&#xff0c;对平台…

PHP民宿管理APP---附源码74921

摘 要 随着旅游业的蓬勃发展和人们对个性化旅行体验的追求&#xff0c;民宿行业正迅速崛起并受到广大游客的青睐。民宿不仅为游客提供了更加亲近自然、体验当地文化的机会&#xff0c;同时也为房东带来了可观的经济收益。然而&#xff0c;随着民宿市场的不断扩大&#xff0c;民…

AI预测福彩3D采取888=3策略+和值012路或胆码测试9月14日新模型预测第87弹

经过80多期的测试&#xff0c;当然有很多彩友也一直在观察我每天发的预测结果&#xff0c;得到了一个非常有价值的信息&#xff0c;那就是9码定位的命中率非常高&#xff0c;80多期一共只错了8次&#xff0c;这给喜欢打私房菜的朋友提供了极高价值的预测结果~当然了&#xff0c…

自动驾驶:LQR、ILQR和DDP原理、公式推导以及代码演示(四、LQG和iLQG篇)

&#xff08;四&#xff09;LQG和iLQG原理、公式推导以及代码演示 在实际工程应用中&#xff0c;噪声是系统无法避免的因素&#xff0c;主要包括过程噪声和观测噪声。在自动控制、机器人、自主驾驶等领域&#xff0c;噪声的影响尤其显著。为了提高控制系统的鲁棒性和性能&…

MIPI CSI 接口定义与协议层介绍

文章目录 Definitions and AcronymsCSI-2 BriefD-PHYC-PHYM-PHYCSI-2 Layer DefinitionsMulti-Lane Distribution and MergingMulti-Lane InteroperabilityProtocol LayerLow Level ProtocolPacket FormatLong Packet FormatWhat does D-PHY Long Packet look like?What does …

类的初始化列表

文章目录 一、初始化列表1、初始化列表的使用2、必须使用初始化列表来初始化的成员 二、类型转换1、内置类型转换自定义类型2、自定义类型转换自定义类型 三、静态成员变量(static)1、static修饰成员变量2、静态成员函数 四、友元五、类里面再定义类六、匿名对象1、匿名对象的使…

大厂硬件梦:字节、腾讯“向首”,华为、小米“向手”

涉足可穿戴设备的大厂们&#xff0c;都抱着再造用户入口的野望&#xff0c;大模型治不好的痼疾&#xff0c;仍需继续前行寻找解药。 转载&#xff1a;科技新知 原创 作者丨茯神 编辑丨蕨影 苹果发布会再次令网友失望&#xff01;相比iPhone新机配色丑上热搜&#xff0c;反而苹…

Type-C与PD技术融合:重塑移动硬盘盒的未来

Type-C接口与PD充电技术&#xff1a;移动硬盘盒的革新之路 在数字化浪潮的汹涌澎湃中&#xff0c;我们的生活与工作环境被各式各样的电子设备所包围。从智能手机到平板电脑&#xff0c;从笔记本电脑到高清显示器&#xff0c;每一个设备都在以惊人的速度迭代更新&#xff0c;推…

集运系统:让海外集运包裹管理更简单!

随着全球化贸易的快速发展&#xff0c;海外包裹代收、仓储管理、退换货、国际快递等服务需求日益增长。集运系统作为一种专为海外客户提供一站式服务的软件系统&#xff0c;通过整合物流信息、管理订单、跟踪货物等功能&#xff0c;有效满足这些需求。本文将介绍集运系统的功能…

Python数据类型详解:这12个类型你都知道吗?

在Python中&#xff0c;数据类型是编程的基石&#xff0c;它们定义了可以操作的数据的种类。Python是一种动态类型语言&#xff0c;意味着你不需要显式地声明变量的类型&#xff1b;Python解释器会自动推断出变量所存储数据的类型。Python提供了多种内置数据类型&#xff0c;这…

立足本土,面向全球 | 全视通闪耀亮相Medical Fair Asia新加坡医疗展

Medical Fair Asia是亚洲地区最大的医疗设备、医疗器械和医疗技术展览会之一&#xff0c;自1997年创办以来&#xff0c;每两年在新加坡举办一次。该展会不仅是新加坡医疗行业交流的龙头平台&#xff0c;也是亚洲乃至全球医疗企业和专业人士共聚一堂、展示最新产品和技术的重要舞…

人情债VS利息债:如何更好的借贷?

在人生的旅途中&#xff0c;谁不曾遭遇资金紧张的瞬间&#xff1f;面对这样的挑战&#xff0c;是向亲朋好友伸出援手&#xff0c;还是探索贷款之路&#xff0c;成为了一个值得深思的问题。今天&#xff0c;我们就以小刘的经历为镜&#xff0c;共同探讨这一话题。 故事的主角小刘…

Modbus协议03:Modbus功能码和协议分类

视频链接&#xff1a;【3】Modbus协议功能码说明_哔哩哔哩_bilibili【3】Modbus协议功能码说明是【直播回放】小白也可以听懂的Modbus协议讲解的第3集视频&#xff0c;该合集共计4集&#xff0c;视频收藏或关注UP主&#xff0c;及时了解更多相关视频内容。https://www.bilibili…

详解:冒泡排序

1.是什么 冒泡排序&#xff08;Bubble Sort&#xff09;是一种简单的排序算法。它重复地遍历要排序的数列&#xff0c;一次比较两个元素&#xff0c;如果它们的顺序错误就把它们交换过来。遍历数列的工作是重复地进行直到没有再需要交换&#xff0c;也就是说该数列已经排序完成…

C语言-数据结构 无向图克鲁斯卡尔算法(Kruskal)邻接矩阵存储

相比普里姆算法来说&#xff0c;克鲁斯卡尔的想法是从边出发&#xff0c;不管是理解上还是实现上都更简单&#xff0c;实现思路&#xff1a;我们先把找到所有边存到一个边集数组里面&#xff0c;并进行升序排序&#xff0c;然后依次从里面取出每一条边&#xff0c;如果不存在回…

python vtk 绘制圆柱体和包围盒

基本的代码如下&#xff0c; import vtkcylinder vtk.vtkCylinderSource() cylinder.SetRadius(3.0) cylinder.SetHeight(10.0) cylinder.SetResolution(50)boundsFilter vtk.vtkOutlineFilter() boundsFilter.SetInputConnection(cylinder.GetOutputPort())mapper vtk.vtk…