Effective PyCharm Transcripts
Chapter: The Editor
Lecture: Working with the editor demo: Listing episodes
Login or purchase this course to watch this video and the rest of the course contents.
0:00 We've come a long way with our app and we've seen some really cool features but boy bar there more to go.
0:06 Let's keep it exploring. So over here let's come back to the top here I
0:11 realized I haven't called print header yet and then we're going to download some things.
0:15 So let's see here's our podcast downloader and there's the episode being printed out but we don't really need to do that do we?
0:24 What we'd like to do is we would like to show the details. So let's go over and say show titles or something like that.
0:32 Now PyCharm just like it would add download info to service. It's going to do the same but for locally so come down here and say show
0:39 titles now this totally works. But remember my philosophy I like this high level main function at the top so I'm gonna put this below down here.
0:49 All right so now we want to show the titles now that we've downloaded some items that's going to mean some more functions for our service.
0:56 Let's start by getting the lowest and the highest episode number. So we'll say I'll call this start it's going to be something will say
1:05 service.get_min_episode_id. Something like that. And then again 'cmd+d' because I'm going to write something so similar
1:15 and max these don't exist until we hit. 'Alt+enter' and then they do and because we store this in a dictionary and the dictionary has the ID's
1:28 right there as the episode ID's. all we have to do is say we're going to return in this case the min of episodes dot check out all the dictionary.
1:37 Auto complete. Fantastic what we want are the keys and same thing I want to have basically the same functions to highlight this 'cmd+d'.
1:45 Changed the min's to max and we'll be all golden. Be a little reformatting. Perfect.
1:53 But these are looking good and then we just want to loop over these items so
1:59 we'll say we're gonna start at the beginning range from start and this is a non
2:05 inclusive end. So I'm gonna do a plus one right there and that will give us all the numbers from start to end.
2:11 My integers inclusive. And then I'll just get the episode we'll go to our service and right one final function. Get details. Passing the episode id
2:21 It doesn't exist it takes a parameter we alt to enter it now we have a function. Get details with a guest at the parameter name.
2:31 That seems decent. And here we can just return episodes. Get now we could it's a dictionary.
2:38 We could try it like this style episode I'd but if it's not there it's going to crash and I'd rather return none and just say you know I got no details
2:46 so we're gonna do a get(episode_id) and I think we're about good to go So let's just print out a couple of things.
2:54 We're going to print out a cool little f string and let me show you something amazing about f strings and PyCharm. Remember f strings? We go like this,
3:01 we put an F at the beginning and we say something and then we can go right, let's see and we can put like the end or some variable in
3:09 here. So that's standard. But what's amazing is so often I'll get to this part and realize, oh this should have been an F string back,
3:17 back, back, back back F forward, forward forward. It's quite annoying. So here's the cool thing come over here.
3:24 I'm going to say I would like to print out something to do with variable or whatever. So we'll put a number and then we'll put the id out there and
3:33 let's try that type parentheses, nothing's happening. But if I start to type it will auto complete.
3:39 If I don't pick anything, it'll just keep going as a regular string. But if I pick out of this list, it automatically makes it an F string.
3:46 Beautiful. What I want is id. Now there's another thing that's not super fun notice there's no help here, there's no information about what this is.
3:55 We'll fix that in a moment. Okay, so this is going to be, I think I'll say 'episode.title'. Clean things up. We call on the show titles we are.
4:06 I think this might work. Let's give it a run. Oh fantastic. Look at that. How cool is that? We got it totally working.
4:14 There's all the great episodes we've done over the past five years incredible. HDMX
4:19 And Data science and Docker. But here's the episode id we parsed out here is
4:25 the here's the actual title. Maybe make a little more obvious by putting it like uh this something like that. Fantastic little app,
4:39 cool features. We've got our F strings, we've got creating this local function,
4:45 all kinds of good stuff. We're able to do with this part of our editor demo