Skip to content

Random python utils I'm making for my own use. Also using this to apply some basic OOP

License

Notifications You must be signed in to change notification settings

TechWiz-3/python-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Random python utils I'm making for my own use. Also using this to apply some basic OOP

pip install wise-py-utils
>>> from wise.<util_file> import <UtilClass>

# Example:
>>> from wise.datetimeutils import GetDay

Enter the specific directory to get more about each utility.

Returns a string containing the weekday of the current or specified date.

In depth info

Datetime utils

The python datetime module is very versatile however as shown in this stackoverflow answer. Getting a date's weekday as a string is not so simple. Python's datetime. datetime.weekday() returns an integer, 0 for Monday ... ... and 6 for Sunday.

This module allows me to get a string containing the date (current or otherwise specified) with a single method.

Examples

Simply get the current day of the week

today = GetDay()
print(today.get_weekday())

Output:
'Saturday'

Get the day of a specified date

from datetime import datetime
today = GetDay(datetime(2017, 2, 2))
print(today.get_weekday())

Output:
'Thursday'

Get the day based on the weekday number using the `get_weekday_from_number() classmethod

>>> import datetime
>>> number = datetime.datetime.today().weekday()
>>> print(number)
1
>>> print(GetDay.get_weekday_from_number(number))
'Tuesday'

Enter typos

Often when hitting enter, I accidentally hit a key next to it. Often the resulting input can end up looking like this.

characters = ["/", "'" "\" "]"]
input = "<regular input> <random-character><enter>"

This library is designed to remove trailing special characters from strings and integers and return what the user actually mean to enter.

Scan files

Scans a specified file for a regex or string pattern and returns a list of all the results`

About

Random python utils I'm making for my own use. Also using this to apply some basic OOP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages