دوره Using Python to Access Web Data ، فصل 2 : Regular Expressions (Chapter 11)
دربارهی این فصل:
Regular expressions are a very specialized language that allow us to succinctly search strings and extract data from strings. Regular expressions are a language unto themselves. It is not essential to know how to use regular expressions, but they can be quite useful and powerful.
این شامل 4 زیر است:
It's kind of fun, once you know how to use them, because they're very, very powerful, and you can add a little character here and do these things, and if you had to do something the same way with the sophistication of regular expressions, you'd have to write quite a bit of code. So inside Python, there's regular expressions are sort of not built into the base language, like strings or lists or dictionaries. So that basically says, if we translate this little regular expression with English, is I'm looking for lines that have an X at the beginning, capital X, followed by any number of characters, followed by a colon.
And up to now we've just been playing with the search which gives us back a true or a false depending on whether it matches or not, but now we're going to actually pull stuff out. So this is kind of like a split and a for loop and checking to see if it's a number, and a whole bunch of stuff all rolled into one in one little program. And so here's a little bit of code that sort of uses regular expressions to both pick lines and extract data.
We've learned a lesson at this Office Hours, and that is don't meet in coffee shops, otherwise security gets called. Don't worry it's wide angle so you don't, it's not like I'm getting your nose, it's a wide-angle lens. I just finished a course and I'm getting ready to start Internet History.
How do we make sure that the space probes don't get the logical equivalent of the blue screen of death halfway to Mars, where we can't send a repairman? If I'm putting up a small application for my own use, or if somebody is trying to push out a little cute web app, they don't need that kind of reliability and maybe what I'm talking about, in terms of programming, is not for them. On the other hand, if you took the attitude of first to market is the only thing that happens and apply them to the steering wheel of my car, no, that's not a good idea.
مشارکت کنندگان در این صفحه
تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.
🖊 شما نیز میتوانید برای مشارکت در ترجمهی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.