Simplifys aspects of python
Project description
███████╗██╗███╗ ███╗██████╗ ██╗ ██╗███████╗██╗ ██╗ ██╔════╝██║████╗ ████║██╔══██╗██║ ██║██╔════╝╚██╗ ██╔╝ ███████╗██║██╔████╔██║██████╔╝██║ ██║█████╗ ╚████╔╝ ╚════██║██║██║╚██╔╝██║██╔═══╝ ██║ ██║██╔══╝ ╚██╔╝ ███████║██║██║ ╚═╝ ██║██║ ███████╗██║██║ ██║ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ built by @Necrownyx
Simplify Python
This is a python package designed to reduce the need for code to be over-complex by providing one-line solutions to problems.
Features list
- Json: Json is a package widely used for data storage.
- print: print is used to print to the terminal.
More coming soon.
Documentation
This is a section for the documentation for all of the modules in the package.
Json
First import the Json branch of the package with:
from SimplifyPython import sjson
Then you can choose to create a file with:
sjson.new(filename)
where filename is either the name of a json
file without the .json
or a filename with an extension for example data.app.json
.
Or if you already have a file you can read it with:
data = sjson.open(filename)
where filename is either the name of a file. This will set the data variable to be the contents of the json file.
Then when you are finished editing the data you can run:
sjson.save(data, filename)
where data is the edited data to be put in the json
file and filename is either the name of a file.
First import the print branch with:
from SimplifyPython import sprint
Then to use the package type:
`sprint.{color}(message)
Where color is a color from the below list and treat message like a normal print command arguments.
- red
- pink
- purple
- blue
- lightblue
- brightblue
- green
- lightgreen
- yellow
- orange
This will print in the color of your choice.
Flask
Then import the sflask branch with:
from SimplifyPython import sflask
Then add this one line to start the server:
sflask.start()
The start()
command has an optional parameter for a message on the web page to be pinged.
How to run on a thread.
If you want to run the server on its own thread you can put this in your code:
sflask.thread().start()
This module of the package can also take a custom message for example:
sflask.thread("hello, world!").start()
Will output "hello, world!" on the webpage.
How to serve multiple pages.
If you want to serve multiple different pages first create the page use either:
sflask.create_page(route, message)
with route
being the route of the site for example: '/'
and message
being the message to be served to users or a html file name for example index.html
this file must be in the templates directory of your project.
You can loop through this as many times as you want.
Then when you have defined all of the pages for your site run:
sflask.launch_pages().start()
To run all the sites on a thread or:
sflask.launch_pages_nothread()
To run the sites on the main thread.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for SimplifyPython-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ebf6b507f36e32ff9e72824e149b49db60900b9ac07a280d851519c52a7d58 |
|
MD5 | 75198abb90bfed90ffc7bde4e493e8d6 |
|
BLAKE2b-256 | bc70d35ba0d493d38b1ec63934d0a7eed4422fb16f302848300a3ef1ef46f2cb |