Two days of learning Python, grammar slowly familiar with it, the data structure has not written.
Wrote a little thing about climbing pictures. It's very interesting. All the goddess photos (????)
With a regular expression,
1 " "2 Symbols:3 . Match any character, except \ n4 * Match the previous character one or more times5 ? Match the previous character 0 or 1 times6 . * Greedy Match7 .*? Non-greedy match8 () returns the parenthesis content9 Method:Ten FindAll One Search A Sub - - The most used is (. *?) the " "
Requests import, I am also drunk, but also to Easy_install,pip,
Then everything is ready, browser open source http:\/, is this kind of ghost thing, I use Word to replace, found no, too many invisible characters, so with Notepad replaced, and finally the best way, I have chrome updated.
1 ImportRe2 ImportRequests3 4f = open ('Html.txt','R')5fileshtml =F.read ()6 f.close ()7 8Pic_url = Re.findall ('src2= "(. *?)"', Fileshtml,re. S)9 Teni =0 One foreachinchPic_url: A - ifEach[0] = ='h': - Print each thePic =Requests.get (each) -fp = open ('pic\\'+ STR (i) +'. jpg','WB') - fp.write (pic.content) - fp.close () +i + = 1
Python Crawl Pictures