Hi! Let me introduce *PySimpleInput*
This library is still on development progress. if you've found a bugs, report it to me at PySimpleInput Github Issues
You can install PySimpleInput with pip or using .whl
pip3 install --upgrade PySimpleInput
pip3 install (PySimpleInput Wheel File).whlif you want the latest update, choose the devel branch, if you want stable update then choose main branch
import PySimpleInput
pysim = PySimpleInput.PySimpleInput()
input()
process_()
process_ might like input but its only used for processing text
ex. filtering user input to return only numbersNote: argument "options" in method input() and process_() are same
this section contain all options that available in PySimpleInput
rmwhtspc_* :
this option will remove all white space in user input string
rmwhtspc_arr
Note: If you're using this option, you might cannot use some of the options
It'll return array/list instead of str
ex. `o = pysimpleinput.input("What's your name?", ["rmwhtspc_arr"])
Result.
"Joseph Arauro" > "["Joseph", "Arauro"]"
rmwhtspc_str
It'll return str
ex.
o = pysimpleinput.input("What is your name?", ["rmwhtspc_str"])
Result.
"Joseph Arauro" -> "JosephArauro"
filter_num
this option will filter user input to return only numbers
ex.
pysimOut = pysimpleinput.input("How old are you?", ["filternum"])
Result. -->
"oejnzo299kwjo02" -> "29902"
filteralph
This option will filter user input to return alphabet characters only
ex.
pysimOut = pysimpleinput.input("Type random string!", ["filteralph"])
Result. -->
"hello219282839my282872name283739191is8287399turtleion" -> "hellomynameisturtleion"
passwd_input
Note: If you use this option, please make sure you have access to
/dev/tty.(Unix User)
This option will make the input hidden
(NO EXAMPLE)
upcase and lowcase
This option will change the user input letters to uppercase or vice versa
ex.
pysimOut = pysimpleinput.input("What is your name?", options=["upcase/lowcase"])
Result. -->
"gerardo martinuez firatzi" <(OR)> "GERARDO MARTINUEZ FIRATZI"
min_[NUMBER] and max_[NUMBER]
Now, you can set min/max length for the input
ex.
res = pysimpleinput.input("What's your name?", options["min_8", "max_20"])
User Inputted: Fred
The prompt will ask you again if you didn't pass the requirements
translate and tr_[COUNTRY ISOCODE]
Note: Please use "translate" option at the end of "options" list argument
This option will translate the input to another language You must add "tr_[COUNTRY ISOCODE]" after the translate option
Supported Language COUNTRY ISOCODE
like this:
tr_en > translate_englishtr_de > translate_deutsch or translate_germanytr_fr > translate_french
Example: (Translating from Indonesia to English)ex.
tr = pysimpleinput.input("Apa makanan favorit mu?", options["translate", "tr_en"])
User inputted: "Aku suka Nasi Goreng"
Result. -->
I like fried rice.
(DEPRECATED) valemail
This option will validate an email from the user
ex. `pysimOut = pysimpleinput.input("Type an email!",["valemail"])
Result. -->
True | False (If the string is an email it will return True otherwise False)
(DEPRECATED) validate_phonenumber
This option will validate an phone number from the user
ex. `pysimOut = pysimpleinput.input("Type your phone numbers!", ["valphnum])
Result. -->
PhoneNumber | Warning (If the string is a valid number it will return the number back otherwise a warning
pysim = pysimpleinput.input("What is your name?", ["rmwhtspc_str","filteralph")
I'm Appreciate you for contributing on this modules
You can Contribute by forking this repo and start adding more features, optimizing code and fixing bugs Then you can make a pull request to this repo and wait your pull request merged
--> Changelog | 0.0.3
--> Changelog | 0.0.3.1
--> Changelog | 0.0.3.5
--> Changelog | 0.0.4
--> Changelog | 0.0.5
--> Changelog | 0.0.5-REV2
--> Changelog | 0.0.6
[COUNTRY ISOCODE][NUM] and max_[NUM]This project was made 100% by Me (Turtleion) This project was licensed by MIT License Visit my GitHub https://github.com/turtleion
Sorry for bad English, I'am Indonesian btw :).