listinput 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
list_input/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .input_handlers import get_strings, get_numbers, get_multi_line
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
def get_strings(prompt="Enter items separated by spaces: ", sep=" "):
|
|
2
|
+
"""Gets a list of strings from a single line of input."""
|
|
3
|
+
return input(prompt).split(sep)
|
|
4
|
+
|
|
5
|
+
def get_numbers(prompt="Enter numbers separated by spaces: ", sep=" ", num_type=int):
|
|
6
|
+
"""Gets a list of numbers (int or float) from a single line of input."""
|
|
7
|
+
raw_input = input(prompt).split(sep)
|
|
8
|
+
return [num_type(x) for x in raw_input if x.strip()]
|
|
9
|
+
|
|
10
|
+
def get_multi_line(prompt="Enter item (type 'done' to finish): ", stop_word="done"):
|
|
11
|
+
"""Collects items one by one in a loop until the stop word is typed."""
|
|
12
|
+
items = []
|
|
13
|
+
while True:
|
|
14
|
+
user_input = input(prompt)
|
|
15
|
+
if user_input.strip().lower() == stop_word.lower():
|
|
16
|
+
break
|
|
17
|
+
items.append(user_input)
|
|
18
|
+
return items
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: listinput
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A custom package to handle various user list inputs easily.
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
list_input/__init__.py,sha256=YYL1-t8tL08LPTfY5YgfiS8iVl-zdM6oXT_q1wK90tg,70
|
|
2
|
+
list_input/input_handlers.py,sha256=qRPBzL1T88D0GQiVZixGYPg0MSOVzq5p7cltzQfE7dE,804
|
|
3
|
+
listinput-0.1.0.dist-info/METADATA,sha256=XHoqtjj8K6ciGcwlCwRMr0RYR483UOXUiagmhTCK0C0,390
|
|
4
|
+
listinput-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
listinput-0.1.0.dist-info/top_level.txt,sha256=a-fSsfvGnSk0IQoRpZ4NRfmQOwIRDz2-NaNb2RX2aBs,11
|
|
6
|
+
listinput-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
list_input
|