пожалуйста, возвращайтесь позднее
пожалуйста, возвращайтесь позднее
>> PARLANTE: Back to pie quick Python class. So, the — so, this morning I'm going to talk about regular expression a little bit, in particular, regular expressions in Python. You may or may not know regular expressions before hand. That's okay. And I'm not going to show you all of regular expressions. I will show you, like, just enough for us to get some useful stuff on. But regular expressions are a very powerful combination with Python. There's a nice integration and so on. I will show you that. Also, the exercises later today will, of course, you know, have little elements which are solved nicely with Python regular expressions. Just as a — regular expressions are sort of a good news, bad news situation. They — regular expressions are very — I mean, I could use the word powerful but also, like, I could use the word very dense. Like, if you sort of measured the amount of thought and cups of coffee that get poured into, like, per character, like the regular expressions are, like, the most dense language possibly. You could possible for hours over, like, one line of text trying to get, like, all the pats and backticks, and whatever crack. We're not going to get into that scary [INDISTINCT] but they are — we're going to sort of touch into a little bit of that part. So, one word of warning, when messing with regular expressions, it's the — I tend — I try to move a little slowly, like, they are very powerful, they are a little tricky, so I'm going to try to be careful. And for, you know, today's discussion, like, yeah, I'm going to show you just sort of basic stuff. And if you're extremely familiar with regular expressions, well, you know, just bear with me for a little bit. We're not going to do this for too long. And, obviously, really I'm going to emphasize on Python. That's the bad news. The good news is also on all the exercises we're going to do later today, in case I forget to mentions, if there is a regular expression component at the very end printed in little tiny print, I put the what the regular expression solution is. So, it's kind of like you can sort of flip to the back and get the answer if you get — if you're struggling with that part of it, because really, you know, it is a Python class. So, I don't want you to block on regular expressions too much. All right, so with that introduction, let me — I'm going to start talking about how these things work. But first, I have to tell you a joke which [INDISTINCT]. What do you call a pig with three eyes? Piiig. All right, now, that will be covered. The necessity, that will become clear a little bit. So let me fire up the interpreter here. So, regular expressions in Python are supported by a module called "re." So, I'm just going to import that. I'm going to do a lot of stuff here in the interpreter. I'm going to sort of build this up. So, the basic idea with regular expressions is their way of searching for a pattern inside of a larger text. So very much like, you know, search in Microsoft Word where you have the little pattern you're looking for, and it's going to look over this huge text and find the first instance of that pattern. But it's this whole language where the patterns can be very popular. So the way this works in Python the simplest way is there is a function inside of re called "search." And I'll sort of spec this out.