[Python planting system] the best green plant for your girlfriend. Girls love it when they see it! Attachment: should be able to feed - right??!

Gu Muzi acridine 2021-10-29 03:45:14
python planting best green plant

Introduction

The position of green plants in home can be said to be more and more important , It is also the most effective soft packing material !

however , Different from other soft clothes players , Green plants have softer life , You need to take care of . So here comes the question , Always keep the plants dead, how to break ?

I've always had a little interest in raising some small plants , But I can't live every time , Except for the green rose , Ha ha ha ! Raised roses 、 Gardenia comes back with a bud and cools in a few days !23333~

see , I don't want to die , Recently, I started a small pot of succulent green plants .【 I bought it when I heard that it's rich and easy to feed !】 This pot is a bluebird fleshy plant ! The color is very beautiful ~ I fell in love with a high-value eye .

I just don't know how many days this pot of meat can last in my hand ? Not to mention to feed this plant , At least be careful ~ So I carefully prepared to start raising .

But I don't know the habit of succulent plants , Light and so on ——

SO  Made a Python Interface applet — Small data query system for succulent plants , The day of maintenance 、 Apply fertilizer 、 Breeding and so on are all in it !

I must have lived this time ! There are people who grow succulent plants at home. This time, there are benefits , Follow Xiaobian ~

Text

This paper is based on Pyqt5 Interface applet , The first is to install the environment !

(1) Environmental installation :Python3、Pycharm Installation package ;PyQt5、pillow、requests Modules and some self-contained modules .

 The module installation system uses the image source of Douban :pip install -i https://pypi.douban.com/simple/ + Module name .

(2) The selected meat data website is this :http://www.mengsang.com/duorou/ You need to get these data first . The code is as follows :

'''
Function:
Fleshy data crawler
'''
import os
import time
import random
import pickle
import requests
from lxml import etree
''' Fleshy data crawler '''
class SucculentCrawler():
def __init__(self, **kwargs):
self.referer_list = ["http://www.google.com/", "http://www.bing.com/", "http://www.baidu.com/", "https://www.360.cn/"]
self.ua_list = ['Mozilla/5.0 (Linux; Android 5.1.1; Z828 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Mobile Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',
'Mozilla/5.0 (iPad; CPU OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/47.0.2526.107 Mobile/12F69 Safari/600.1.4',
'Mozilla/5.0 (iPad; CPU OS 11_2_5 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) CriOS/64.0.3282.112 Mobile/15D60 Safari/604.1',
'Mozilla/5.0 (Linux; Android 7.1.1; SM-T350 Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Safari/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36',
'Mozilla/5.0 (Linux; Android 6.0.1; SM-G610F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
'Mozilla/5.0 (Linux; Android 5.1.1; 5065N Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Mobile Safari/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36']
self.page_urls = self.__getAllPageUrls()
self.page_pointer = -1
self.savedir = 'resources/succulents'
''' Crawl to the next page '''
def next(self):
# For a link
self.page_pointer += 1
if self.page_pointer >= len(self.page_urls):
return True
page_url = self.page_urls[self.page_pointer]
# Extract the fleshy picture on this page + Details page link
res = requests.get(page_url, headers=self.__randomHeaders())
res.encoding = 'gbk'
html = etree.HTML(res.text)
html = html.xpath('//span[@class="tImgUlImg"]')
succulent_list = []
for item in html:
succulent_list.append([item.xpath('a/@title')[0].replace('/', '-').replace('\\', '-'), item.xpath('a/img/@src')[0], item.xpath('a/@href')[0]])
# Crawl the details page data
for item in succulent_list:
data = [item[0], item[1]]
headers = self.__randomHeaders()
headers.update({'Referer': page_url})
res = requests.get(item[-1], headers=headers)
res.encoding = 'gbk'
html_root = etree.HTML(res.text).xpath('//div[@class="cbRight"]/div[@class="mainBox"]')[0]
html = html_root.xpath('div[2]/table[@class="tTable"]/tr')[1:]
intro = [' Reproduction : ', ' Easy activity : ', ' season : ', ' temperature : ', ' sunshine : ', ' Watering amount : ',
' Sunshine description : ', ' Watering instructions : ', ' Categories: / Belong to : ', ' Chinese species name : ', ' English scientific name : ']
for idx, tr in enumerate(html):
if idx == 0:
intro[0] = intro[0] + tr.xpath('./td[2]/text()')[0] if tr.xpath('./td[2]/text()') else intro[0] + ' Unknown '
intro[1] = intro[1] + int(tr.xpath('./td[4]/img/@src')[0].split('/')[-1].split('.')[0][1:]) * ''
elif idx == 1:
intro[2] = intro[2] + tr.xpath('./td[2]/text()')[0] if tr.xpath('./td[2]/text()') else intro[2] + ' Unknown '
intro[3] = intro[3] + tr.xpath('./td[4]/text()')[0].strip().replace(' ', '') if tr.xpath('./td[4]/text()') else intro[3]
elif idx == 2:
intro[4] = intro[4] + int(tr.xpath('./td[2]/img/@src')[0].split('/')[-1].split('.')[0]) * ''
intro[5] = intro[5] + int(tr.xpath('./td[4]/img/@src')[0].split('/')[-1].split('.')[0][1:]) * ''
html = html_root.xpath('div[2]/div')[0].xpath('//div[@class="pt5"]')
for idx, item in enumerate(html):
if idx == 0:
intro[6] = intro[6] + item.xpath('./span/text()')[0]
elif idx == 1:
intro[7] = intro[7] + item.xpath('./span/text()')[0]
elif idx == 3:
intro[8] = intro[8] + item.xpath('text()')[0] if item.xpath('text()') else intro[8] + ' Unknown '
elif idx == 4:
intro[9] = intro[9] + item.xpath('text()')[0] if item.xpath('text()') else intro[9] + ' Unknown '
elif idx == 5:
intro[10] = intro[10] + item.xpath('text()')[0] if item.xpath('text()') else intro[10] + ' Unknown '
data.append(intro)
self.__saveItem(data)
time.sleep(random.random())
return False
''' Save the data '''
def __saveItem(self, data):
if not os.path.exists(self.savedir):
os.mkdir(self.savedir)
savepath = os.path.join(self.savedir, data[0])
if not os.path.exists(savepath):
os.mkdir(savepath)
f = open(os.path.join(savepath, 'show.jpg'), 'wb')
f.write(requests.get(data[1], headers=self.__randomHeaders()).content)
f.close()
f = open(os.path.join(savepath, 'info.pkl'), 'wb')
pickle.dump(data, f)
f.close()
''' Get all links '''
def __getAllPageUrls(self):
res = requests.get('http://www.mengsang.com/duorou/list_1_1.html', headers=self.__randomHeaders())
res.encoding = 'gbk'
html = etree.HTML(res.text)
num_pages = html.xpath('//span[@class="pageinfo"]/strong')[0].text
page_urls = ['http://www.mengsang.com/duorou/list_1_%s.html' % i for i in range(1, int(num_pages)+1)]
return page_urls
''' Random request header '''
def __randomHeaders(self):
return {'user-agent': random.choice(self.ua_list), 'referer': random.choice(self.referer_list)}

(3) System interface settings .

class SucculentQuery(QWidget):
def __init__(self, parent=None, **kwargs):
super(SucculentQuery, self).__init__(parent)
self.setWindowTitle(' Succulent plants —— Data query system ')
self.setWindowIcon(QIcon('resources/icon/icon.png'))
# Defining components
self.label_name = QLabel(' Fleshy name : ')
self.line_edit = QLineEdit()
self.button_find = QPushButton()
self.button_find.setText(' Inquire about ')
self.label_result = QLabel(' Query results :')
self.show_label = QLabel()
self.show_label.setFixedSize(300, 300)
self.showLabelImage('resources/icon/icon.png')
self.text_result = QTextEdit()
self.button_random = QPushButton()
self.button_random.setText(' Random reads ')
self.button_update = QPushButton()
self.button_update.setText(' Data update ')
self.tip_label = QLabel()
self.tip_label.setText(' Data status : Data is not being updated , Data update progress : 0/0')
# Typesetting
self.grid = QGridLayout()
self.grid.addWidget(self.label_name, 0, 0, 1, 1)
self.grid.addWidget(self.line_edit, 0, 1, 1, 30)
self.grid.addWidget(self.button_find, 0, 31, 1, 1)
self.grid.addWidget(self.button_random, 0, 32, 1, 1)
self.grid.addWidget(self.button_update, 0, 33, 1, 1)
self.grid.addWidget(self.tip_label, 1, 0, 1, 31)
self.grid.addWidget(self.label_result, 2, 0)
self.grid.addWidget(self.text_result, 3, 0, 1, 34)
self.grid.addWidget(self.show_label, 3, 34, 1, 1)
self.setLayout(self.grid)
self.resize(600, 400)
# Event binding
self.button_find.clicked.connect(self.find)
self.button_random.clicked.connect(self.randomRead)
self.button_update.clicked.connect(lambda _: threading.Thread(target=self.update).start())

The effect is as follows ——

​ summary

Want succulent plants to grow normally , On the one hand, we should ensure that the root system is good , On the other hand, we should apply a small amount of fertilizer , Don't get too dry .

Especially in autumn and winter when meat is in control , Without watering for a long time, old leaves consume more , The blades gather , New leaves don't grow , Although the color comes out , But the meat will obviously become smaller ~ When did I raise green plants like this, it will really succeed !

Complete free source code collection office :

For complete project source code + See... For the source code base of the material :# Private letter editor 06# Or click the blue text to add to get free benefits !

Your support is my biggest motivation !! Remember Sanlian ~mua  Welcome to read previous articles ~

I recommend previous articles :

Python—2021 | Summary of existing articles | Continuous updating , Just read this article directly ~

版权声明
本文为[Gu Muzi acridine]所创,转载请带上原文链接,感谢
https://pythonmana.com/2021/10/20211013154823243Z.html

  1. 怎么用Python打印数字三角
  2. 怎麼用Python打印數字三角
  3. Comment imprimer un triangle numérique en python
  4. Tester la fonctionnalité de base du tableau de développement microspython mm32f3277 Flying - by - flying
  5. Python extrait plusieurs champs de plusieurs chaînes
  6. Pandas核心用法
  7. Utilisation centrale de pandas
  8. Python, problème de fonctionnement du fichier de données, Code désiré
  9. 【78技术人社群~Python分部】,就在今天成立 →
  10. 社区共读《Python编程从入门到实践》第一天阅读建议
  11. La communauté lit les recommandations de lecture pour la première journée de la programmation Python de l'introduction à la pratique
  12. [78 Communauté des technologues ~ Division Python], fondée aujourd'hui →
  13. Pandas核心用法
  14. 您好,请问您的python按钮开了线程处理还卡ui的问题解决了吗
  15. Python: résolution d'exemples, je ne sais pas comment attendre que tous les chiffres soient entrés avant de sortir
  16. Bonjour, puis - je vous demander si votre bouton Python est activé pour le traitement du thread et le retour de l'interface utilisateur de la carte a été résolu?
  17. Utilisation centrale de pandas
  18. Python technique 2: advanced usage of function parameters
  19. OpenCV-Python实战(14)——人脸检测详解(仅需6行代码学会4种人脸检测方法)
  20. OpenCV-Python實戰(14)——人臉檢測詳解(僅需6行代碼學會4種人臉檢測方法)
  21. OpenCV - Python Real play (14) - face detection details (six lignes de code seulement pour apprendre 4 méthodes de détection de visage)
  22. 你好,python开发mes系统,能分享下吗,我最近也想搞这方面的
  23. 你好,python開發mes系統,能分享下嗎,我最近也想搞這方面的
  24. Bonjour, Python a développé mon système, pouvez - vous le partager?
  25. Introduction to tuples in Python
  26. Introduction to strings in python (Part 2)
  27. Introduction to strings in python (Part 1)
  28. python关于 if 的简单操作时,输出结果不是预期所要的结果 的问题
  29. python關於 if 的簡單操作時,輸出結果不是預期所要的結果 的問題
  30. Lorsque Python fonctionne simplement sur if, la sortie n'est pas le résultat attendu
  31. Python中字典问题请求解惑
  32. Python中字典問題請求解惑
  33. Demande de résolution de problèmes de dictionnaire en python
  34. Python中字典问题请求解惑
  35. Python technique 2: advanced usage of function parameters
  36. Demande de résolution de problèmes de dictionnaire en python
  37. Preliminary Knowledge - Python Core use Common Data Analysis Library (ⅱ)
  38. 关于python的代码问题,终端打印为什么会起飞
  39. En ce qui concerne les problèmes de code Python, pourquoi l'impression du terminal décolle - t - elle?
  40. Python中种子seed的运用问题
  41. L'application de Seed en python
  42. Python functional programming series 008: Testability
  43. [must see for getting started with Python] the difference and connection between cookie and session in Python!
  44. Python Xiaobai from scratch pyqt5 project actual combat (4) basic controls
  45. Python Xiaobai starts the pyqt5 project from scratch (3) connection between signal and slot
  46. Echarts ne peut pas afficher le HTML en PDF en utilisant le pdfkit de Python
  47. 一只Python 小white 的日常提问(づ ●─● )づ
  48. 2021 tutoriel complet d'automatisation des tests d'interface python [matériel d'apprentissage joint]
  49. Décrivez ce que les connaissances pertinentes jouent dans votre travail en utilisant arduino ou Python, y compris les bibliothèques pertinentes, en conjonction avec votre travail quotidien.
  50. Une question quotidienne d'un petit morceau de Python (づ● - ●)
  51. Python中字典问题请求解惑
  52. 一只Python 小white 的日常提問(づ ●─● )づ
  53. 在python中的问题,请问如何解决
  54. Only 10 questions are needed to easily master Matplotlib graphics processing | Python skill tree
  55. 在python中的問題,請問如何解决
  56. Comment résoudre le problème en python
  57. Demande de résolution de problèmes de dictionnaire en python
  58. 使用python,在一个命名为.txt文本文档写入n m乘法表。
  59. En utilisant Python, écrivez une table de multiplication n m dans un document texte nommé.txt.
  60. 使用python,在一個命名為.txt文本文檔寫入n m乘法錶。