Built in function supplement, anonymous function and closure

Built in function, anonymous function and closure Anonymous function def func(x,y): return (x,y) print(func(1,2)) # Result: (1,2) f = lambda x,y:(x,y) # lambda keyword print(f(1,2)) # Result: (1,2) print((lambda x,y:(x,y))(1,2)) # Result: (1,2) # The definition and call of anonymous function with one line of code print(lam ...

Posted on Fri, 18 Oct 2019 12:46:08 -0400 by Cheeky Chino

Climb the treasure net with go language

Yesterday, we crawled through the homepage of treasure net and got the city list page. Next, we extracted the city and url from the returned body city list, that is, the value of the href and innerText in the a tag in the following figure. Extract a tag, which can be selected through CSS selector, as follows: $('(cityList > DD > a'); 4 ...

Posted on Thu, 17 Oct 2019 17:11:11 -0400 by riespies

MyBatis dynamic SQL (basic)

Take student table as an example: id name age score 1 zhangsan 11 60 2 lisi 22 60 3 wangwu 33 90 4 zhaoliu 14 59 if tags Define mapping file <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...

Posted on Thu, 17 Oct 2019 13:24:26 -0400 by catnip_uk

EditText common properties and listening events

EditText EditText and Button are subclasses of TextView. The difference is that TextView cannot be edited, while EditText can be edited. Common attributes <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_widt ...

Posted on Thu, 17 Oct 2019 11:44:35 -0400 by arth

elasticsearch Chinese word segmentation plug-in IK analyze

Elastic search version 7.3 Install Chinese word segmentation plug-in The corresponding version of plug-in should be the same as that of elastic search. Download address of plug-in versions https://github.com/medcl/elasticsearch-analysis-ik/releases Install using the elasticsearch native script ./bin/elasticsearch-plugin install https ...

Posted on Thu, 17 Oct 2019 02:05:15 -0400 by Ryaan

Upload and download spring MVC files (detailed explanation)

I. project structure display and precautions II. File upload 1. Upload front-end page building 2. Controller development See code Notes for details: III. file download 1. File download front-end page construction2. Controller development IV. file upload and download controller development code If the ab ...

Posted on Wed, 16 Oct 2019 11:46:31 -0400 by 947740

Talk about the server httpagent of nacos client

order This paper mainly studies the server httpagent of nacos client HttpAgent nacos-1.1.3/client/src/main/java/com/alibaba/nacos/client/config/http/HttpAgent.java public interface HttpAgent { /** * start to get nacos ip list * @return Nothing. * @throws NacosException on get ip list error. */ void start() throws Nac ...

Posted on Wed, 16 Oct 2019 11:02:26 -0400 by w4designs

base64 encoding large files

When you are working on a project, you need to convert the file to base64 encoding and store it in the file. When the file is converted to base64 encoding, the file will be read into memory, base64 encoded and output to the file. Code entry:    FileInputStream stream = new FileInputStream("D:\\desktop\\Programmer-The Fourth Edition.pdf"); ...

Posted on Tue, 15 Oct 2019 12:37:00 -0400 by Hurklefish

Python crawler: urllib Library

Usage of urllib urllib is Python's built-in HTTP request Library Include: urlib.request: request module urlib.error: exception handling Urlib. parse url: URL parsing urllib.robotparser: robots.txt parsing module A basic request # Import urllib Library import urllib.request # Open the URL link and ...

Posted on Mon, 14 Oct 2019 13:33:13 -0400 by ecxzqute

python realizes file batch encoding conversion

Cause: During my junior year as a Japanese exchange student, I took a C language image processing programming course and downloaded sample s on the website of matching books. But because the Ubuntu 18.04 system I used defaults to use utf-8 encoding, and the source code of the file is Shift_JIS encoding, the document annotations are scrambled. W ...

Posted on Mon, 14 Oct 2019 10:27:22 -0400 by BigDaddy13