A few simple Python functions allow you to run shell commands from your Python code
Project description
Shello-world: simple Python functions to run shell commands
A few simple Python functions allow you to run shell commands from your Python code.
Why shello-world?
It is a simple and quick solution if you don't want to use a big library or framework.
Usage
Let's take a look at a simple example below:
from shello_world import shell_execute, shell_run
# Both functions work similarly
# Use shell_run if you want to run a command
# directly in your shell, like you'd enter it
shell_run("color a") # Change font color to green
# But shell_run doesn't return anything
output = shell_run("echo 'This text is printed in the shell'")
print(output is None) # True
# Use shell_execute to get output to use it in your code
# shell_execute doesn't print anything
systeminfo = shell_execute("systeminfo")
# But it always returns result as a string
print(systeminfo.upper())
#
# HOST NAME:
# OS NAME:
# OS VERSION:
# ...
#
Installation
pip
pip install shello-world
poetry
poetry add shello-world
Links
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
shello_world-0.1.5.tar.gz
(2.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shello_world-0.1.5.tar.gz.
File metadata
- Download URL: shello_world-0.1.5.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b21a622647a329d4848d9189202aa10964ec1765f150c10e7f18e9d2df64118
|
|
| MD5 |
c7962c53c37084e7f3cad8e3d3ded0d2
|
|
| BLAKE2b-256 |
043bcc32f52dbcefc78f0dd67b8ab3c2746245bb2e9b157419bab3b1182abe77
|
File details
Details for the file shello_world-0.1.5-py3-none-any.whl.
File metadata
- Download URL: shello_world-0.1.5-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a6e068e838b67c27c10a2709c04e3c8c9fd06e538ab527c43f48f4c955cc035
|
|
| MD5 |
e7d0325d011e6778357f257e61a181b9
|
|
| BLAKE2b-256 |
388a12c0dc632885e1a20c8dd7c255754b28c7721c2f4650d9b1a46fd5c7e870
|