我们如何在安装了每个系统的系统启动时(最好是Linux)使Python脚本自动可执行? [重复] - python

This question already has an answer here:

Create python script that runs at startup [closed]
                                
                                    (1个答案)
                                
                        
                                5年前关闭。
            
                    
我有一个python脚本,必须在启动时自动执行。我知道如何通过在etc / init.d中编辑和添加文件来使其在系统中实现。我已经用setup.py和其他文件为它创建了一个Python包,但是我找不到一种方法来使脚本在每个安装的系统上都可以自动执行。有没有办法使用setup.py来做到这一点?

python大神给出的解决方案

将该脚本放在/etc/rc.local中,以在每次引导系统时执行该脚本。

Python:检查新文件是否在文件夹中[重复] - python

This question already has answers here: How do I watch a file for changes? (23个答案) 3年前关闭。 我是python的新手,但是我尝试创建一个自动化过程,其中我的代码将侦听目录中的新文件条目。例如,某人可以手动将zip文件复制到一个特定的文件夹中,并且我希望我的代码能够在文件完全…

从文件中读取用户名和密码[重复] - python

This question already has answers here: How to read a file line-by-line into a list? (28个答案) 2年前关闭。 如何在Python中逐行读取文本(例如用户名和密码)?例如,我可以在shell / bash中实现此目的:#!/bin/bash AUTH='/aut…

python切片的奇怪行为[重复] - python

This question already has answers here: Reversing a list slice in python (2个答案) 7个月前关闭。 假设我们有以下列表:>>> a = [x for x in range(10)] >>> print(a) [0, 1, 2, 3, 4, 5, 6…

为随机选择的变量分配一个值[重复] - python

This question already has answers here: How do I randomly select a variable from a list, and then modify it in python?                                                              …

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…