In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to develop a personal meme website by Python". In daily operation, I believe that many people have doubts about how to develop a personal meme website by Python. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to develop a personal meme website by Python". Next, please follow the editor to study!
Environment: Windows+Python3.6
IDE: personal preference
Module
Import requestsimport reimport pymysq
Complete code
Import requestsimport reimport pymysql# connects to the database db = pymysql.connect (host = '127.0.0.1) database db =' db',user = 'root',passwd =' root' Charset = 'utf8') # create cursor cursor = db.cursor () # cursor.execute (' select * from images') # print (cursor.fetchall ()) # Little Hump # comment get picture list def getImagesList (page): # get Doutu source code html = requests.get ('http://www.doutula.com/photo/list/?page={}'.format(page)).text # regular expression wildcard. *? Match all groups match reg = (. *?) ". *? alt=" (. *?) "'# S multi-line matching reg = re.compile (reg,re.S) imagesList = re.findall (reg) Html) for i in imagesList: image_url = I [0] image_title = I [1] # format string format% s cursor.execute ("insert into images (`name`, `imageUrl`) values ('{}','{}')" .format (image_title,image_url)) print ('saving% s'%image_title) db.commit () # range range 1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.