Download files in Python

Prerequisite The requests module needs to be installed in advance: pip install requests Put it in code. import requests url = 'XXX' #File download source URL filename = '' #New file name after downloading to local r = requests.get(url) with open(filename, "wb") as code: code.write(r.content) combat exercise with ammunition From target URL ...

Posted by realnsleo on Fri, 07 Feb 2020 08:06:43 -0800

Python web crawler and information extraction note 10 HTML content search method based on bs4 Library

Introduction to 01 requests Library of Python web crawler and information extraction notes Notes on Python web crawler and information extraction 02 "there is a way to steal" from web crawler Python web crawler and information extraction notes 03 requests library web crawler practice (5 i ...

Posted by sfmnetsys on Thu, 06 Feb 2020 01:20:50 -0800

Video decoding with ffmpeg

1. Tool preparation Computer Mac, development tool Android studio 3.4, compilation environment cmake 2. Development steps Create a new module project Create a new cpp folder and a new CMakeLists.txt file in the main directory cmake_minimum_required(VERSION 3.4.1) include_directories(../cpp/incl ...

Posted by vikela on Tue, 04 Feb 2020 10:20:14 -0800

DrawerLayout sideslip and NavigationView use and stepping on the pit

First, let's go on the renderings. After all, there is no renderings. I don't know if it's the effect you want. When I see half of them, I find they are not very annoyingAdd dependency implementation 'com.android.support:design:28.0.0' Use in layout <?xml version="1.0" encoding="utf-8"?> < ...

Posted by Simon180 on Tue, 04 Feb 2020 06:22:19 -0800

Get color int from color resource

Is there any way to get color information from color resources? I'm trying to get the red, blue, and green components of the colors defined in the resource (R.color.myColor) so that I can set the values of the three search bars to a specific level. #1 building Define your color Value / color.xml <?xml version="1.0" encoding="utf ...

Posted by Serpent7 on Mon, 03 Feb 2020 01:50:53 -0800

Data structure -- tree heap, Huffman tree, Huffman code, and search set

Heap (heap) It is mentioned in linear structure queue that a queue is called Priority Queue. The priority of getting elements is based on the priority of elements, not the priority of elements entering the queue. How to organize priority queues? We use the complete binary tree to represent the priorit ...

Posted by matty on Mon, 03 Feb 2020 01:44:35 -0800

Python text data analysis -- news classification task

Inverse Document Frequency (IDF for short) If a certain word is less, but it appears many times in this article, it may reflect the characteristics of this article, which is the key words we need Word frequency (TF) = the number of times a word appears in an article / the number of times a word app ...

Posted by Lijoyx on Sun, 02 Feb 2020 06:11:45 -0800

Simple example of using Hystrix in Spring cloud (Spring cloud learning Note 6)

1, Analysis of current architecture problems 1.1 problem analysis Our current architecture is shown in the figure below. Eureka is used for service discovery service registration, and Ribbon is used for load balancing. Now let's assume that if the service provider's response is very slow, the servic ...

Posted by srfdriver22 on Sun, 02 Feb 2020 05:01:29 -0800

Variables, constants, and their data types

The nature of variables It represents an operable storage space. The location of the space is determined, but what value is placed in it is uncertain. We can access the corresponding storage space through the variable name, so that the value of operating the storage space is defined according to the s ...

Posted by canabatz on Sat, 01 Feb 2020 22:55:43 -0800

How to make the corner circle of the button?

I want to round the corner of the button. Is there an easy way to do this in Android? #1 building Create an xml file in the drawable folder as follows <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <!-- you ...

Posted by dejvos on Sat, 01 Feb 2020 07:47:12 -0800