Children learn Python (20): object oriented
1, Classes and objects
Example 1
class Employee:
'Base class of employee'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
def displayEmployee(self):
print "Name : ", self.name, ", Salary : ", self.salary
# Create the first instance
emp1 = Empl ...
Posted by IG88 on Fri, 01 May 2020 08:27:21 -0700
Python string encryption
①base64
Base64 is a method of representing arbitrary binary data in 64 characters.
When using Notepad to open exe, jpg, pdf files, we will see a lot of garbled code, because binary files contain many characters that cannot be displayed and printed, so if you want text processing software like Notepad to be able to process binary data, you ne ...
Posted by nasty_psycho on Fri, 01 May 2020 07:38:27 -0700
python object-oriented 10 ﹐ init ﹐ and ﹐ new__
1, init and new methods
__The main differences between init and new are:1. Init is usually used to initialize a new instance and control the initialization process, such as adding some properties and doing some extra operations, which occurs after the class instance is created. It is an instance level method.2. New is usually used to control th ...
Posted by NNTB on Fri, 01 May 2020 01:08:13 -0700
Using devpi to build pypi private server in Intranet
Install devpi
Summary
devpi consists of three components:
Devpi server: provides image and cache functions, deploys in the DMZ area of the enterprise, and improves the efficiency of downloading python package
Devpi Web: provide web interface and query function
Devpi client: command line tool, providing package upload and other functions
d ...
Posted by d_barszczak on Thu, 30 Apr 2020 16:57:21 -0700
virtualenv -- python virtual sandbox
notes preceding the text of a book or following the title of an article
It is said that virtualenv, fabric and pip are the three magic tools of Python.
Whether you agree or not, at least first, pip is often used now. virtualenv heard it for the first time, but I have to try it.
1, Installation
pip install virtualenv
Because I have already insta ...
Posted by cbrooks on Thu, 30 Apr 2020 15:51:32 -0700
Instructions for Python [map, reduce, filter] built-in functions
notes preceding the text of a book or following the title of an article
Introduce the methods of map, reduce, and filter built-in functions in Python
1: map
map(...)
map(function, sequence[, sequence, ...]) -> list
Execute function(item) for item in sequence, and output the result as list.
>>> map(str, range(5)) #st ...
Posted by karassik on Thu, 30 Apr 2020 08:22:15 -0700
Download a few pictures on Weibo
Today, when I was playing Weibo, I accidentally thought of using python to crawl and download a few pictures. However, it is found that Weibo is different from ordinary websites,
To get a little content, you need to get a cookie from the browser first. Otherwise, it can't jump automatically. At present, I haven't found a good solution, so I fo ...
Posted by nekoanz on Thu, 30 Apr 2020 07:01:10 -0700
My first web crawler C ා welfare programmer car
Recently, in conscious python, I saw Zhihu's last article (https://www.zhihu.com/question/20799742), and I climbed the video on welfare net...
I started to follow suit, but the example given by the respondent is based on python2.x, and I started to learn 3.x. after changing the print usage, there are still many modules that can't be imported, a ...
Posted by gobbles on Thu, 30 Apr 2020 04:46:48 -0700
python: advanced object-oriented
1. Reflection
Reflection: using string type names to manipulate variables
Reflection has no security problem. It can operate the existing variables in memory
#Attributes and methods in reflective objects
class A:
price=20
print(getattr(A,'price'))
#Reflecting object properties
class A:
def func(self):
print('in func')
a =A ...
Posted by ts2000abc on Thu, 30 Apr 2020 02:00:32 -0700
Using Python as a hacker to brutally crack wifi password
The first few articles mainly introduced the knowledge of using delphi to develop back door and simple remote control. Some partners said delphi was out of date and nobody used it. But I think programming language is just a way to realize functions, just use the language you are familiar with or like.
DELPHI hacker programming (1): implementati ...
Posted by QbertsBrother on Wed, 29 Apr 2020 20:49:33 -0700