Skip to main content

安全输入工具库,支持彩色输出,KeyboardInterrupt保护等

Project description

Code_Tools

介绍:

一个给初学者制作的 Python 工具库, 基于 Python 3.14.4 制作

安装

pip install code_tools

可用内容

color()

参数包括text_color(选择颜色,使用ANSI序列码), mode(显示方式, 常用的是"1", 如果不需要显示方式, 使用默认方式可以输入"0"), IsEnter 默认是True, 也就是多换一行, 你可以更换设置为False让输出没有多余换行, 函数参数最后面可以增加end, sep等操作

clear_screen()

直接输入这个函数名就可以让代码检测你的系统并使用对应的清屏命令

例如:

"win32" = Windows

else = macOS, Linux

对应代码为:

from sys import platform, exit
from subprocess import run

if platform == "win32" # <- win32 == Windows
    run("cls", shell=True)
else: # <- 包括 macOS 和 Linux
    run("clear", shell=True)
safe_input()
safe_int()
safe_float()

除了 safe_input 以外都包括 ValueError 处理, 因为 input 不可能触发 ValueError

3个函数包括的参数有: prompt, text_color, mode

prompt 是用户输入提示

text_color 是用户提示的颜色, 就像 color 函数中的 text_color 一样

mode 也是 color 中的意思, 不过这次如果 color 和 mode 参数不写就会使用默认参数 ( 37 白色和 0 默认)

< 感谢您的阅读, 我是Luci_Code, 一名2014年出生的开发者 >

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

luci_code_tools-0.1.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

luci_code_tools-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file luci_code_tools-0.1.1.tar.gz.

File metadata

  • Download URL: luci_code_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for luci_code_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b668bc759d99ad35815a83aa9fdc456f0b8845f9d1be0d50e59caf216f55668d
MD5 056122dbd19f49f9d95bae171c9b2b03
BLAKE2b-256 a9775dc3bb34838c885d95f87ed97de23670192d7eaecebec0f060d5e62d3293

See more details on using hashes here.

File details

Details for the file luci_code_tools-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for luci_code_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28bc69e619cb58fca5d9fb62546ec3873f97d5d66ca55e21ceb149a961470eb9
MD5 ff1570e465fc86427ecef79bea88af07
BLAKE2b-256 5ae88f5ee1b03fcb0a87f219d40c1a20a9b5f4969193bceca48ac4c605994218

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page