Converts seconds to human readable text or tuple
Project description
Seconds to Text
Converts seconds to human readable text or tuple
from secondstotext import Sectxt, txtsec
Sectxt:
Args:
seconds:
Amount of seconds for it to process.
Can be float (at least 3 decimals) or int.
Can be negative but will be changed to positive.
listgen:
Generates a list of responses
used for string generation but can
be used externally if needed.
print(Sectxt(-12069123).listgen())
showzeros: trims any part before the first not 0.
print(Sectxt(-12069123).showzeros())
4 Months, 18 Days, 0 Hours, 32 Minutes, 3 Seconds
showall: shows all parts.
print(Sectxt(12069123).showall())
0 Years, 4 Months, 18 Days, 0 Hours, 32 Minutes, 3 Seconds, 0 ms
rawtuple: returns a 7 part tuple.
print(Sectxt(12069123).rawtuple())
(0, 4, 18, 0, 32, 3, 0)
default: skips any part of the response that is 0.
print(Sectxt(12069123.135156484))
4 Months, 18 Days, 32 Minutes, 3 Seconds, 135ms
Text to seconds: converts a string to seconds.
Args:
text:
A string to convert to seconds, comma seperated.
Can be any combination of:
Years, Months, Days, Hours, Minutes, Seconds, ms
Y,y,M,D,d,H,h,m,S,s,ms are all accepted.
Capitalized M is Month and lower case m is minute if single letter.
print(txtsec("1 Year, 2 Months, 3 Days, 4 Hours, 5 Minutes, 6 Seconds, 7 ms"))
= 37065900.007
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
secondstotext-1.0.2b0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for secondstotext-1.0.2b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f0c1da13310c52f11882a57376649bbc1aa2a538469f81c84960f4c8930331e |
|
MD5 | 3d969517488bc26583995757180e25dd |
|
BLAKE2b-256 | 38ccc48e692ad4b2718a75b6edfeeaf16c75a9630f4b7b89270336eb11dd0655 |