Category:Python

  • Various skills and methods of writing classes in Python

    Time:2019-12-15

    brief introduction Various techniques and methods for writing classes in python (build and initialize, overload operator, class description, property access control, custom sequence, reflection mechanism, callable object, context management, build descriptor object, pickling). You can use it as a tutorial, an advanced, or a reference; I hope it can be a user-friendly guide to Python […]

  • Design and implementation of Python Gobang game

    Time:2019-12-15

    This Python small case is the implementation of the Gobang game. In this case, we can realize that two players of the Gobang game fall at the designated position, draw the board after falling, and judge the winning or losing function according to the function. The idea of this case is as follows: First, draw […]

  • No module named ‘pip’ exception

    Time:2019-12-14

    scene When upgrading with PIP python install –upgrade named pip   When prompted: No module named pip     Note: Blog:https://blog.csdn.net/badao_liumang_qizhi Pay attention to the public addressDomineering procedural apeGet programming related ebooks, tutorials and free downloads. Realization After troubleshooting the system variables, if it is not due to the problems of Python 2 and python […]

  • Pyqt pop up a new dialog box and close the dialog box to get the data instance

    Time:2019-12-14

    As follows: from PyQt4 import QtGui,QtCore import sys class Web_Browser(QtGui.QDialog): def __init__(self,parent=None): QtGui.QWidget.__init__(self) self.resize(550,400) open=QtGui.QPushButton(‘OPEN’) self.connect(open,QtCore.SIGNAL(‘clicked()’),self.ok) grid=QtGui.QGridLayout() grid.addWidget(open,1,0,1,1) self.setLayout(grid) self.setWindowTitle(‘main windows’) def ok(self): web=Web_Browser() web.setModal(False) web.setWindowTitle(‘sub window’) web.exec_() app=QtGui.QApplication(sys.argv) app.setFont(QtGui.QFont(“Helvetica”, 16)) main=Web_Browser() main.show() sys.exit(app.exec_()) The above pyqt pop-up new dialog box and the example of closing the dialog box to get data are all the […]

  • Socket based on Python to realize the game from single player Gobang to double player

    Time:2019-12-13

    Based on the socket of python, we can realize the game from single player Gobang to double player duel for your reference. The details are as follows This experiment uses Python language. The communication between different machines through socket can be divided into the following four steps: 1. Create ServerSocket and socket; 2. Open input […]

  • The difference between single quotation mark, double quotation mark, three single quotation marks and three double quotation marks in Python

    Time:2019-12-13

    I. single quotation mark and double quotation markIn Python, we all know that single and double quotation marks can be used to represent a string, such as str1 = ‘python’ str2 = “python” There is no difference between STR1 and STR2. But if you need to escape characters, look at the versions of single and […]

  • The difference between str() and repr() functions in Python

    Time:2019-12-12

    Python has a way to turn any value into a string: pass it into the repr() or str() function. The str () function is used to convert the value to a human readable form, while the repr () function is used to convert the value to a human readable form. For numeric types and list […]

  • Set up the method of supporting high resolution screen adaption in Qt5 and pyqt5

    Time:2019-12-12

    PyQt5: Program entry add QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) Qt5: Program entry add QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); The above method of setting up high-resolution screen adaption support in Qt5 and pyqt5 is all the content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developepaer more.

  • Restframe work details

    Time:2019-12-11

    1. How to write views 1.1 first type: original apiview url(r’^login/$’,account.LoginView.as_view()), from rest_framework.views import APIView from rest_framework.response import Response from rest_framework_jwt.settings import api_settings from rest_framework.throttling import AnonRateThrottle from api import models class LoginView(APIView): authentication_classes = [] def post(self,request,*args,**kwargs): #1. Check whether the user can log in according to the user name and password user = […]

  • Detailed explanation of requests advanced usage in Python 3 web crawler

    Time:2019-12-11

    In this section, we will learn about some advanced uses of requests, such as file upload, proxy settings, cookies settings, etc. 1. File upload We know that requeests can simulate the submission of some data. If some websites need us to upload files, we can also use it to upload. The implementation is very simple. […]

  • paramiko

    Time:2019-12-10

    1.paramiko It is used to help developers connect to the server remotely through code and operate the server. pip3 install paramiko Remote execution command [user name and password] import paramiko #Create SSH object ssh = paramiko.SSHClient() #Allow connections to hosts that are not in the know? Hosts file ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Connect to server ssh.connect(hostname=’192.168.16.85′, port=22, username=’root’, […]

  • The method of realizing font size adaptive resolution with pyqt5

    Time:2019-12-10

    Recently, we have encountered a phenomenon that running a good software on a higher resolution computer will lead to incomplete font display and occlusion by controls. Specific reasons can be inquired online, and solutions will be recorded here. Two methods are recorded here. If the QT version used is later than 5.6.0, it can support […]