Throwable源码

news2024/11/27 12:05:49

介绍

Throwable类是Java语言中所有错误(errors)和异常(exceptions)的父类,直接子类为 Error 和 Exception。只有继承于Throwable的类或子类才能被抛出,还有一种是Java中的@throw注解类也可以抛出。

public class Throwable implements Serializable

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2F1SD8CZ-1685659816058)(null)]

常量&变量

    /** use serialVersionUID from JDK 1.0.2 for interoperability */
    //序列化版本号
    private static final long serialVersionUID = -3042686055658047285L;

    /**
     * Native code saves some indication of the stack backtrace in this slot.
     * 保存栈信息的轨迹
     */
    private transient Object backtrace;

    /**
     * Specific details about the Throwable.  For example, for
     * {@code FileNotFoundException}, this contains the name of
     * the file that could not be found.
     *
     * @serial
     * 存储异常的简要说明,可以通过e.getMessage()获得。
     */
    private String detailMessage;

    /**
     * A shared value for an empty stack.
     *   stackTrace的初始值 空数组

     */
    private static final StackTraceElement[] UNASSIGNED_STACK = new StackTraceElement[0];

    /*
     * To allow Throwable objects to be made immutable and safely
     * reused by the JVM, such as OutOfMemoryErrors, fields of
     * Throwable that are writable in response to user actions, cause,
     * stackTrace, and suppressedExceptions obey the following
     * protocol:
     *
     * 1) The fields are initialized to a non-null sentinel value
     * which indicates the value has logically not been set.
     *
     * 2) Writing a null to the field indicates further writes
     * are forbidden
     *
     * 3) The sentinel value may be replaced with another non-null
     * value.
     *
     * For example, implementations of the HotSpot JVM have
     * preallocated OutOfMemoryError objects to provide for better
     * diagnosability of that situation.  These objects are created
     * without calling the constructor for that class and the fields
     * in question are initialized to null.  To support this
     * capability, any new fields added to Throwable that require
     * being initialized to a non-null value require a coordinated JVM
     * change.
     */

    /**
     * The throwable that caused this throwable to get thrown, or null if this
     * throwable was not caused by another throwable, or if the causative
     * throwable is unknown.  If this field is equal to this throwable itself,
     * it indicates that the cause of this throwable has not yet been
     * initialized.
     *
     * @serial
     * @since 1.4
     * 表示产生当前异常的根本原因。可以使用构造方法,或者initCause方法进行设置。
     */
    private Throwable cause = this;

    /**
     * The stack trace, as returned by {@link #getStackTrace()}.
     *
     * The field is initialized to a zero-length array.  A {@code
     * null} value of this field indicates subsequent calls to {@link
     * #setStackTrace(StackTraceElement[])} and {@link
     * #fillInStackTrace()} will be be no-ops.
     *
     * @serial
     * @since 1.4
     * 存储异常栈信息
     * 代码的行号会在源码编译时一起编译到字节码中。
     * 在运行发生异常时,方法调用栈会写到stackTrace字段中。
     * 栈的顶端是异常发生的位置,即throw的位置;栈的底端是线程开始的位置。
     * 我们可以通过e.printStackTrace、e.getStackTrace等方法查看异常栈,来分析程序出错的位置在源码中的位置。
     */
    private StackTraceElement[] stackTrace = UNASSIGNED_STACK;

    // Setting this static field introduces an acceptable
    // initialization dependency on a few java.util classes.
    //特殊量(sentinel)来表示特定的状态。比如,stackTrace为UNASSIGNED_STACK代表初始值,为null代表不可访问。
    private static final List<Throwable> SUPPRESSED_SENTINEL =
        Collections.unmodifiableList(new ArrayList<Throwable>(0));

    /**
     * The list of suppressed exceptions, as returned by {@link
     * #getSuppressed()}.  The list is initialized to a zero-element
     * unmodifiable sentinel list.  When a serialized Throwable is
     * read in, if the {@code suppressedExceptions} field points to a
     * zero-element list, the field is reset to the sentinel value.
     *
     * @serial
     * @since 1.7
     * 用来存储其他的不是强关联的异常,防止异常的丢失。
     */
    private List<Throwable> suppressedExceptions = SUPPRESSED_SENTINEL;

    /** Message for trying to suppress a null exception. */
    //空异常
    private static final String NULL_CAUSE_MESSAGE = "Cannot suppress a null exception.";

    /** Message for trying to suppress oneself. */
    private static final String SELF_SUPPRESSION_MESSAGE = "Self-suppression not permitted";

    /** Caption  for labeling causative exception stack traces */
    private static final String CAUSE_CAPTION = "Caused by: ";

    /** Caption for labeling suppressed exception stack traces */
    private static final String SUPPRESSED_CAPTION = "Suppressed: ";
    
    //空的异常数组
    private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];

构造方法

    /**
     * Constructs a new throwable with {@code null} as its detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * <p>The {@link #fillInStackTrace()} method is called to initialize
     * the stack trace data in the newly created throwable.
     * 构造一个新的可抛出的null作为其详细信息。 原因未初始化,可以随后通过调用initCause(java.lang.Throwable)进行初始化 。
     */
    public Throwable() {
        fillInStackTrace();
    }

    /**
     * Constructs a new throwable with the specified detail message.  The
     * cause is not initialized, and may subsequently be initialized by
     * a call to {@link #initCause}.
     *
     * <p>The {@link #fillInStackTrace()} method is called to initialize
     * the stack trace data in the newly created throwable.
     *
     * @param   message   the detail message. The detail message is saved for
     *          later retrieval by the {@link #getMessage()} method.
     *   构造一个具有指定的详细信息的新的throwable。 原因未初始化,可以随后通过调用initCause(java.lang.Throwable)进行初始化 。
     */
    public Throwable(String message) {
        fillInStackTrace();
        detailMessage = message;
    }

    /**
     * Constructs a new throwable with the specified detail message and
     * cause.  <p>Note that the detail message associated with
     * {@code cause} is <i>not</i> automatically incorporated in
     * this throwable's detail message.
     *
     * <p>The {@link #fillInStackTrace()} method is called to initialize
     * the stack trace data in the newly created throwable.
     *
     * @param  message the detail message (which is saved for later retrieval
     *         by the {@link #getMessage()} method).
     * @param  cause the cause (which is saved for later retrieval by the
     *         {@link #getCause()} method).  (A {@code null} value is
     *         permitted, and indicates that the cause is nonexistent or
     *         unknown.)
     * @since  1.4
     * 构造一个具有指定的详细信息和原因的新的throwable。
     */
    public Throwable(String message, Throwable cause) {
        //填充堆栈信息
        fillInStackTrace();
        detailMessage = message;
        this.cause = cause;
    }

    /**
     * Constructs a new throwable with the specified cause and a detail
     * message of {@code (cause==null ? null : cause.toString())} (which
     * typically contains the class and detail message of {@code cause}).
     * This constructor is useful for throwables that are little more than
     * wrappers for other throwables (for example, {@link
     * java.security.PrivilegedActionException}).
     *
     * <p>The {@link #fillInStackTrace()} method is called to initialize
     * the stack trace data in the newly created throwable.
     *
     * @param  cause the cause (which is saved for later retrieval by the
     *         {@link #getCause()} method).  (A {@code null} value is
     *         permitted, and indicates that the cause is nonexistent or
     *         unknown.)
     * @since  1.4
     * 构造具有指定的原因和详细消息的新throwable
     */
    public Throwable(Throwable cause) {
        fillInStackTrace();
        //cause允许为空值,表示原因不存在或未知。
        detailMessage = (cause==null ? null : cause.toString());
        this.cause = cause;
    }

    /**
     * Constructs a new throwable with the specified detail message,
     * cause, {@linkplain #addSuppressed suppression} enabled or
     * disabled, and writable stack trace enabled or disabled.  If
     * suppression is disabled, {@link #getSuppressed} for this object
     * will return a zero-length array and calls to {@link
     * #addSuppressed} that would otherwise append an exception to the
     * suppressed list will have no effect.  If the writable stack
     * trace is false, this constructor will not call {@link
     * #fillInStackTrace()}, a {@code null} will be written to the
     * {@code stackTrace} field, and subsequent calls to {@code
     * fillInStackTrace} and {@link
     * #setStackTrace(StackTraceElement[])} will not set the stack
     * trace.  If the writable stack trace is false, {@link
     * #getStackTrace} will return a zero length array.
     *
     * <p>Note that the other constructors of {@code Throwable} treat
     * suppression as being enabled and the stack trace as being
     * writable.  Subclasses of {@code Throwable} should document any
     * conditions under which suppression is disabled and document
     * conditions under which the stack trace is not writable.
     * Disabling of suppression should only occur in exceptional
     * circumstances where special requirements exist, such as a
     * virtual machine reusing exception objects under low-memory
     * situations.  Circumstances where a given exception object is
     * repeatedly caught and rethrown, such as to implement control
     * flow between two sub-systems, is another situation where
     * immutable throwable objects would be appropriate.
     *
     * @param  message the detail message.
     * @param cause the cause.  (A {@code null} value is permitted,
     * and indicates that the cause is nonexistent or unknown.)
     * @param enableSuppression whether or not suppression is enabled or disabled
     * @param writableStackTrace whether or not the stack trace should be
     *                           writable
     *
     * @see OutOfMemoryError
     * @see NullPointerException
     * @see ArithmeticException
     * @since 1.7
     * 构造一个具有指定原因和详细信息的新的throwable,启用或禁用suppression和启用或禁用可写栈跟踪。
     * 禁用Suppression只应在特殊情况下存在特殊要求,例如虚拟机在低内存情况下重用异常对象。 给定异常对象被重复捕获并重新引导的情况,例如在两个子系统之间实现控制流的情况是另一种情况,即不可变的可抛出对象是合适的。
     */
    protected Throwable(String message, Throwable cause,
                        boolean enableSuppression,
                        boolean writableStackTrace) {
        if (writableStackTrace) {
            //初始化堆栈跟踪数据
            fillInStackTrace();
        } else {
            //禁用写入堆栈跟踪数据
            stackTrace = null;
        }
        detailMessage = message;
        this.cause = cause;
        if (!enableSuppression)
            //禁用Suppression
            suppressedExceptions = null;
    }

常用方法

fillInStackTrace

初始化新创建的throwable中的堆栈跟踪数据

    /**
     * Fills in the execution stack trace. This method records within this
     * {@code Throwable} object information about the current state of
     * the stack frames for the current thread.
     *
     * <p>If the stack trace of this {@code Throwable} {@linkplain
     * Throwable#Throwable(String, Throwable, boolean, boolean) is not
     * writable}, calling this method has no effect.
     *
     * @return  a reference to this {@code Throwable} instance.
     * @see     java.lang.Throwable#printStackTrace()
     * 初始化新创建的throwable中的堆栈跟踪数据
     */
    public synchronized Throwable fillInStackTrace() {
        //判断stackTrace、backtrace是否为null
        if (stackTrace != null ||
            backtrace != null /* Out of protocol state */ ) {
            //将当前线程的栈帧信息记录到此Throwable中
            fillInStackTrace(0);
            stackTrace = UNASSIGNED_STACK;
        }
        return this;
    }
    //native
    private native Throwable fillInStackTrace(int dummy);

printStackTrace()

将异常栈信息打印到标准错误流中

    /**
     * Prints this throwable and its backtrace to the
     * standard error stream. This method prints a stack trace for this
     * {@code Throwable} object on the error output stream that is
     * the value of the field {@code System.err}. The first line of
     * output contains the result of the {@link #toString()} method for
     * this object.  Remaining lines represent data previously recorded by
     * the method {@link #fillInStackTrace()}. The format of this
     * information depends on the implementation, but the following
     * example may be regarded as typical:
     * <blockquote><pre>
     * java.lang.NullPointerException
     *         at MyClass.mash(MyClass.java:9)
     *         at MyClass.crunch(MyClass.java:6)
     *         at MyClass.main(MyClass.java:3)
     * </pre></blockquote>
     * This example was produced by running the program:
     * <pre>
     * class MyClass {
     *     public static void main(String[] args) {
     *         crunch(null);
     *     }
     *     static void crunch(int[] a) {
     *         mash(a);
     *     }
     *     static void mash(int[] b) {
     *         System.out.println(b[0]);
     *     }
     * }
     * </pre>
     * The backtrace for a throwable with an initialized, non-null cause
     * should generally include the backtrace for the cause.  The format
     * of this information depends on the implementation, but the following
     * example may be regarded as typical:
     * <pre>
     * HighLevelException: MidLevelException: LowLevelException
     *         at Junk.a(Junk.java:13)
     *         at Junk.main(Junk.java:4)
     * Caused by: MidLevelException: LowLevelException
     *         at Junk.c(Junk.java:23)
     *         at Junk.b(Junk.java:17)
     *         at Junk.a(Junk.java:11)
     *         ... 1 more
     * Caused by: LowLevelException
     *         at Junk.e(Junk.java:30)
     *         at Junk.d(Junk.java:27)
     *         at Junk.c(Junk.java:21)
     *         ... 3 more
     * </pre>
     * Note the presence of lines containing the characters {@code "..."}.
     * These lines indicate that the remainder of the stack trace for this
     * exception matches the indicated number of frames from the bottom of the
     * stack trace of the exception that was caused by this exception (the
     * "enclosing" exception).  This shorthand can greatly reduce the length
     * of the output in the common case where a wrapped exception is thrown
     * from same method as the "causative exception" is caught.  The above
     * example was produced by running the program:
     * <pre>
     * public class Junk {
     *     public static void main(String args[]) {
     *         try {
     *             a();
     *         } catch(HighLevelException e) {
     *             e.printStackTrace();
     *         }
     *     }
     *     static void a() throws HighLevelException {
     *         try {
     *             b();
     *         } catch(MidLevelException e) {
     *             throw new HighLevelException(e);
     *         }
     *     }
     *     static void b() throws MidLevelException {
     *         c();
     *     }
     *     static void c() throws MidLevelException {
     *         try {
     *             d();
     *         } catch(LowLevelException e) {
     *             throw new MidLevelException(e);
     *         }
     *     }
     *     static void d() throws LowLevelException {
     *        e();
     *     }
     *     static void e() throws LowLevelException {
     *         throw new LowLevelException();
     *     }
     * }
     *
     * class HighLevelException extends Exception {
     *     HighLevelException(Throwable cause) { super(cause); }
     * }
     *
     * class MidLevelException extends Exception {
     *     MidLevelException(Throwable cause)  { super(cause); }
     * }
     *
     * class LowLevelException extends Exception {
     * }
     * </pre>
     * As of release 7, the platform supports the notion of
     * <i>suppressed exceptions</i> (in conjunction with the {@code
     * try}-with-resources statement). Any exceptions that were
     * suppressed in order to deliver an exception are printed out
     * beneath the stack trace.  The format of this information
     * depends on the implementation, but the following example may be
     * regarded as typical:
     *
     * <pre>
     * Exception in thread "main" java.lang.Exception: Something happened
     *  at Foo.bar(Foo.java:10)
     *  at Foo.main(Foo.java:5)
     *  Suppressed: Resource$CloseFailException: Resource ID = 0
     *          at Resource.close(Resource.java:26)
     *          at Foo.bar(Foo.java:9)
     *          ... 1 more
     * </pre>
     * Note that the "... n more" notation is used on suppressed exceptions
     * just at it is used on causes. Unlike causes, suppressed exceptions are
     * indented beyond their "containing exceptions."
     *
     * <p>An exception can have both a cause and one or more suppressed
     * exceptions:
     * <pre>
     * Exception in thread "main" java.lang.Exception: Main block
     *  at Foo3.main(Foo3.java:7)
     *  Suppressed: Resource$CloseFailException: Resource ID = 2
     *          at Resource.close(Resource.java:26)
     *          at Foo3.main(Foo3.java:5)
     *  Suppressed: Resource$CloseFailException: Resource ID = 1
     *          at Resource.close(Resource.java:26)
     *          at Foo3.main(Foo3.java:5)
     * Caused by: java.lang.Exception: I did it
     *  at Foo3.main(Foo3.java:8)
     * </pre>
     * Likewise, a suppressed exception can have a cause:
     * <pre>
     * Exception in thread "main" java.lang.Exception: Main block
     *  at Foo4.main(Foo4.java:6)
     *  Suppressed: Resource2$CloseFailException: Resource ID = 1
     *          at Resource2.close(Resource2.java:20)
     *          at Foo4.main(Foo4.java:5)
     *  Caused by: java.lang.Exception: Rats, you caught me
     *          at Resource2$CloseFailException.&lt;init&gt;(Resource2.java:45)
     *          ... 2 more
     * </pre>
     */
    public void printStackTrace() {
        printStackTrace(System.err);
    }

    /**
     * Prints this throwable and its backtrace to the specified print stream.
     *
     * @param s {@code PrintStream} to use for output
     */
    public void printStackTrace(PrintStream s) {
        printStackTrace(new WrappedPrintStream(s));
    }

    //把Throwable对象和他的异常栈信息打印到标准错误流中
    private void printStackTrace(PrintStreamOrWriter s) {
        // Guard against malicious overrides of Throwable.equals by
        // using a Set with identity equality semantics.
        Set<Throwable> dejaVu =
            Collections.newSetFromMap(new IdentityHashMap<Throwable, Boolean>());
        dejaVu.add(this);

        synchronized (s.lock()) {
            // Print our stack trace
            // 打印当前异常的详细信息
            s.println(this);
            // 打印当前堆栈中的栈帧信息
            StackTraceElement[] trace = getOurStackTrace();
            for (StackTraceElement traceElement : trace)
                s.println("\tat " + traceElement);

            // Print suppressed exceptions, if any
            //打印出suppress异常信息
            for (Throwable se : getSuppressed())
                se.printEnclosedStackTrace(s, trace, SUPPRESSED_CAPTION, "\t", dejaVu);

            // Print cause, if any
             递归打印出引起当前异常的异常信息
            Throwable ourCause = getCause();
            if (ourCause != null)
                ourCause.printEnclosedStackTrace(s, trace, CAUSE_CAPTION, "", dejaVu);
        }
    }

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

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

相关文章

Stub实验

需求 将区域12设置为Stub区域&#xff0c;使区域12的路由设备不受外部链路影响(不接收4/5类LSA&#xff09;降低区域12&#xff08;末梢区域&#xff09;设备压力&#xff0c;还能让区域12的PC1与外部PC3通信 配置步骤 1&#xff09;配置接口信息 - 配置PC的IP地址 - 配置路由…

chatgpt赋能python:Python免费资料全揭秘:入门学习到深入应用

Python免费资料全揭秘&#xff1a;入门学习到深入应用 作为一种最具代表性的动态编程语言&#xff0c;Python在很多领域得到了广泛的应用&#xff0c;因其简单易学、开发效率快等特点而备受开发者的喜爱。如果你刚开始学习Python或是想提高你的Python编程技能&#xff0c;那么…

系统移植-环境搭建

安装系统 在基于ARM处理器的开发板上安装Linux系统 1.移植的目的 不同架构的处理器指令集不兼容&#xff0c;即便是相同的处理器架构&#xff0c;板卡不同驱动代码也不兼容 &#xff1b; Linux是一个通用的内核并不是为某一个特定的处理器架构或板卡设计的&#xff0c;…

【生物力学】《人体骨肌系统生物力学》- 王成焘老师 - 第3章 - 人体运动测量与仿真分析

第2章回到目录后续暂时用不到 文章目录 3.1 概论1. 基于影像的运动捕捉技术2 . 其他运动捕捉技术 3.2 人体运动测量内容与设备3.2.1 人体运动测量内容1. 时间参数2. 空间参数3. 时空参数 3.2.2 运动捕捉系统的主要类型与工作特性1. 运动捕捉系统组成2. 运动捕捉系统主要类型与工…

chatgpt赋能python:用Python做股票分析

用Python做股票分析 在当今的股市中&#xff0c;数据分析和预测已经变得十分重要。Python作为最流行的编程语言之一&#xff0c;不仅易于学习&#xff0c;还有非常强大的数据处理和分析能力。在本文中&#xff0c;我们将探讨如何用Python进行股票分析。 数据收集 要进行股票…

Java网络开发(Tomcat)——遇到的 bug 汇总(持续更新):bug:

目录 引出:bug::bug::bug:Tomcat开发的bug汇总session不能转换成String类型在servlet的if处理流程中&#xff0c;没有加return后端传给jsp的数据&#xff0c;前端jsp不显示jsp的包没有导&#xff0c;用foreach方法的时候报错jsp的forEach方法报错jsp用foreach的时候&#xff0c…

chatgpt赋能python:Python免费软件:提高工作效率的首选

Python免费软件&#xff1a;提高工作效率的首选 Python作为一种易于上手的编程语言&#xff0c;在业界广为流传。而随着Python的发展&#xff0c;也催生了相应的一些免费软件&#xff0c;这些软件能够让用户更好地利用Python编程语言&#xff0c;提高工作效率&#xff0c;创造…

数据存储云安全的 5 大支柱

与任何数据存储系统一样&#xff0c;云也存在相当多的安全风险。领导者不应争论云本身安全或不安全的方式&#xff0c;而应质疑他们是否安全地使用云。 虽然云安全采用组织和云提供商之间的责任共担模式&#xff0c;但归根结底&#xff0c;云环境面临的最大风险是解决方案的错…

对数组中的所有元素进行限值指定的最小值和最大值:超过最大值的元素,则改写为最大值小于最小值的元素,则改写为最小值numpy.clip()

【小白从小学Python、C、Java】 【计算机等级考试500强双证书】 【Python-数据分析】 对数组中的所有元素进行限值 指定的最小值和最大值&#xff1a; 超过最大值的元素&#xff0c;则改写为最大值 小于最小值的元素&#xff0c;则改写为最小值 numpy.clip() [太阳]选择题 请问…

大数据Doris(三十二):HDFS Load和Spark Load的基本原理

文章目录 HDFS Load和Spark Load的基本原理 一、HDFS Load 二、 Spark Load的基本原理 HDFS Load和Spark Load的基本原理 一、HDFS Load HDFS Load主要是将HDFS中的数据导入到Doris中&#xff0c;Hdfs load 创建导入语句&#xff0c;导入方式和Broker Load 基本相同&#…

(字符串 ) 剑指 Offer 05. 替换空格 ——【Leetcode每日一题】

❓剑指 Offer 05. 替换空格 难度&#xff1a;简单 请实现一个函数&#xff0c;把字符串 s 中的每个空格替换成 “%20”。 示例 1&#xff1a; 输入&#xff1a;s “We are happy.” 输出&#xff1a;“We%20are%20happy.” 限制&#xff1a; 0 < s 的长度 < 10000 …

第四章 Electron 使用SQLite3数据库

一、SQLite是什么 &#x1f447; &#x1f447; &#x1f447; SQLite是一种嵌入式关系型数据库管理系统&#xff0c;是一个零配置、无服务器的、自给自足的、事务性的SQL数据库引擎。SQLite是一个轻量级的数据库&#xff0c;可以在各种操作系统上使用&#xff0c;并且支持SQL…

区间预测 | MATLAB实现基于QRCNN-LSTM-Multihead-Attention多头注意力卷积长短期记忆神经网络多变量时间序列区间预测

区间预测 | MATLAB实现基于QRCNN-LSTM-Multihead-Attention多头注意力卷积长短期记忆神经网络多变量时间序列区间预测 目录 区间预测 | MATLAB实现基于QRCNN-LSTM-Multihead-Attention多头注意力卷积长短期记忆神经网络多变量时间序列区间预测效果一览基本介绍模型描述程序设计…

【最小生成树模型】

最小生成树&#xff08;Minimum Spanning Tree&#xff09;模型原理与应用 引言 最小生成树&#xff08;Minimum Spanning Tree&#xff0c;简称MST&#xff09;是图论中的经典问题之一&#xff0c;它在实际应用中有着广泛的应用。本文将介绍最小生成树模型的原理和应用&…

导致无人机倾斜摄影免像控点三维重建中出现模型高程偏差大原因及解决方法探讨

导致无人机倾斜摄影免像控点三维重建中出现模型高程偏差大原因及解决方法探讨 无人机倾斜摄影是一种高效的三维测量技术&#xff0c;可用于建筑物、地形和基础设施等场景的快速、精确测量。然而&#xff0c;在进行无人机倾斜摄影时&#xff0c;出现模型高程偏差大的问题是很常…

梅西生涯数据管理系统(Python+数据库)

文章目录 前言MySQL部分1. 导入数据2. 演示说明 Python部分1. 连接数据库2. 登录界面3. 注册4. 主界面5. 查询用户信息6. 修改密码7. 梅西生涯数据分析8. 主函数 尾声 前言 用 Python MySQL 实现简单的数据分析系统&#xff0c;一起来看看吧&#xff01; 本篇博客主要分为两…

Protobuf快速入门

Protobuf入门 Protobuf介绍 Protobuf (Protocol Buffers) 是谷歌开发的一款无关平台&#xff0c;无关语言&#xff0c;可扩展&#xff0c;轻量级高效的序列化结构的数据格式&#xff0c;用于将自定义数据结构序列化成字节流&#xff0c;和将字节流反序列化为数据结构。所以很…

chatgpt赋能python:Python关联规则——挖掘数据中的隐藏关系

Python关联规则——挖掘数据中的隐藏关系 在数据分析和挖掘中&#xff0c;我们经常需要找到数据集中的关联规则&#xff0c;以便更好地理解数据背后的隐藏关系和趋势。Python关联规则是一种经典的关联规则挖掘算法&#xff0c;它能够识别和发现数据中的有意义的关联性&#xf…

延迟队列的三种实现方案

延迟任务 定时任务&#xff1a;有固定周期的&#xff0c;有明确的触发时间延迟队列&#xff1a;没有固定的开始时间&#xff0c;它常常是由一个事件触发的&#xff0c;而在这个事件触发之后的一段时间内触发另一个事件&#xff0c;任务可以立即执行&#xff0c;也可以延迟 应用…

chatgpt赋能python:Python关联性分析:介绍及应用案例

Python 关联性分析&#xff1a;介绍及应用案例 在数据分析和机器学习领域中&#xff0c;关联性分析是一种经常被使用的工具。通过分析不同特征之间的相关性&#xff0c;可以获取大量有价值的信息&#xff0c;如客户行为模式、产品关联性等等。Python作为一种高效而简洁的编程语…