Python Day 56 – regex and datetime

Today I did some more regex crosswords. Still couldn’t figure out the one that stumped me yesterday, although I managed to do a few more until I reached this one which is currently stumping me:

So then I moved on into this worksheet for wrangling time series data…

I learned:

To import datetime. The basic formatting of creating a date in python. How to use .strftime to format a date into a custom string (with %B, %d, and %Y correlating to string values of each of the types of date values).

I am still confused on:

When importing datetime, the worksheet I have adds a “, date” at the end of the import function. Why is that?

Additionally, I ran into issues attempting to subtract one date from another. I have this code:

birthday = datetime(year = 2022, month = 11, day = 11)
today = date.today()
time_away = birthday – today

However it’s giving me the error: unspported operand type(s) for -: ‘datetime.datetime’ and ‘datetime.date’

Not sure what’s up with that yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: