Using Python -m SimpleHTTPServer to quickly build HTTP services

Summary: On Linux servers or Python-installed machines, you can use nohup python-m SimpleHTTP Server [port] amp; quickly build an HTTP service. Python comes with a Web server, SimpleHTTP Server, on a Linux server or on a machine with Python installed. We can easily use python-m SimpleHTTP Server to quickly build an HTTP service that provides a web service for browsing files. WindowsSystem operation is as follows step1:Open the CMD command window Enter the path of the project step2:Start service The order is as follows: python -m SimpleHTTPServer 8000 Using the above command, you can pub...

Python:PyCharm: selective ignore PEP8 warnings

PyCharm is a powerful Python IDE, and PEP 8 alerts are also useful, but the function name can’t contain capital letters and a few other specifications really feel bad, as a Virgo obsessive compulsive disorderPatients, the wave line below the code is absolutely not allowed to exist.   File -> Settings -> Editor -> Inspections -> right side Python”   PEP 8 naming convention violation alarm ID view”https://pypi.org/project/pep8-naming/ code sample message N801 class names should use CapWords Convention” N802 function name should be lower...

Days of difference between two dates

$Date_1 = date("Y-m-d"); $Date_2 = "2018-8-20"; $d1 = strtotime($Date_1); $d2 = strtotime($Date_2); $Days = ($d2-$d1)/3600/24; echo "Difference.$Days . ""Heaven"; function prDates($start,$end){ // All dates between two dates $dt_start = strtotime($start); $dt_end = strtotime($end); while ($dt_start<=$dt_end){ echo date('Y-m-d',$dt_start)."\n"; $dt_start = strtotime('+1 day',$dt_start); } } prDates('2005-02-01','2005-02-05');  

Selenium+python automation — file download pop-up processing (PyKeyboard)

selenium+pythonAutomatic 99– file download pop-up processing (PyKeyboard) Original: Shanghai leisurely Learning automation test from scratch Learning automation test from scratch Wechat number yoyoketang Functional introduction This public number is dedicated to automated testing and will continue to update automation tutorials covering selenium, appium, python, interface automation, robot framework, jmeter, fiddler, etc. this Preface In the web automation download operation, sometimes pop-up download box, this kind of download box does not belong to the web page, is unabl...

Python: C expansion initial experience

Preface Using Python undoubtedly reduces many rule constraints and development costs, allowing us to focus more on logic than syntax. But gains and losses, development efficiency improved, but has brought operational performance problems, so it is often pursued by other schools of thunder. As a pythoner, we are also very sad, blame us. Fortunately, God closed one of our doors, but he opened another window for us, because the bottom layer was written in C, so we could rewrite some of the more performance-hungry features, or modules, in C, and then import XXXXXX seamlessly.Combination. Even if ...

Python the essence of advanced parts – those books will not tell you the pits.

recursive directory generator mode, else in the TMPShow that getting yield is indispensable, and if you want to use a generator in a recursive algorithm, you need to explicitly get all yield values in the generator’s original function (first call) def get_file_recur(path): children = os.listdir(path) for child in children: qualified_child = os.path.join(path,child) if os.path.isfile(qualified_child): yield qualified_child else: tmp = get_file_recur(qualified_child) for item in tmp: yield item for file ...

Python xml.dom module parses XML

  Reading catalogues 1. What is XML? What are the characteristics? 2. Get tag properties 3. Get child Tags 4. Get label attribute values 5. Get data between labels pairs 6. Example 7. summary Back to the top 1. What is XML? What are the characteristics? xmlThat is,Extensible markup language,It can be used to mark up data and define data types. It is a source language that allows users to define their own markup language. Example: del.xml Structurally, it is much like the HTML hypertext markup language. But they are designed for different purposes. Hypertext markup languages are des...