Join Joe Marini for an in-depth discussion in this video Formatting time output, part of Learning Python.
Now that we've seen how to use Python to retrieve basic date and time information.…Let's take a look at how to format the output using a set of predefined string…control codes. So, what I'm going to do here is in my…example snippets, I'll scroll down to formatting.…I'm going to open up the formatting_start file.…Now in this example file, I've already set up the import statement to import the…datetime class. So, you don't have to do that.…Back over in the snippets. Let's begin by copying over these lines…right here, 196 to 198. And we're going to paste that into the…main right here. So, this line of code should now look…familiar to you. I'm just retrieving the current date and…time using the daytime class's Now function.…
Okay, so now that I've got the current date and time, let's take a look at some…of the options I have available to me to format the output.…Let's begin by looking at some date formatting.…I'm going to copy lines 200 through 202 first.…And these are just comments for now. So, to format date, you can use control…
- Installing Python
- Choosing an editor/IDE
- Working with variables and expressions
- Writing loops
- Using the date, time, and datetime classes
- Reading and writing files
- Fetching Internet data
- Parsing and processing HTML
Skill Level Beginner
1. Preparing the Development Environment
2. Python Basics
3. Working with Dates and Times
4. Working with Files
5. Working with Web Data
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.