Python word cloud [Chinese / English] simple introduction to Xiaobai

1. analysis To build a word cloud, you need to: Raw materials are articles, etc Segmentation of content Using the tool of word cloud construction to construct the content after word segmentation Save as picture 2. Main modules required Chinese word segmentation of jieba wordcloud building word cloud 3. Module principle Implementation princi ...

Posted on Tue, 07 Jan 2020 08:44:23 -0800 by AGISB

Hands to teach you to use Python to achieve "tank war", with detailed code!

Do you remember the "battle of tanks" you played as a child? ​ Full of memories ! Today, we use Python and powerful third-party libraries to implement a simple tank war game. ​ Overall effect Environmental dependence python3.7 pygame1.9.6 urllib Built in libraries, such as random, sys, time, os, etc pygame introductionPyGam ...

Posted on Tue, 07 Jan 2020 08:14:27 -0800 by Mouse

Dictionary of Python introduction

Dictionary of Python introduction 1, What is a dictionary 1. The realization principle of dictionary The implementation principle of the dictionary is similar to that of the difference dictionary. When we look up a word in the dictionary, one way is to turn back from the first page of the dictionary, Until we find the word we are looking for. ...

Posted on Tue, 07 Jan 2020 07:24:49 -0800 by Mijii

What is the Python equivalent of a static variable in a function?

What is the preferred Python equivalent for this C / C + + code? void foo() { static int counter = 0; counter++; printf("counter is %d\n", counter); } Specifically, how do you implement static members at the function level, not at the class level? Does anything change when you put a function into a class? #1 building I p ...

Posted on Tue, 07 Jan 2020 03:02:28 -0800 by skali

Record the process of making pypi package for the first time

Preparation 1. Create a project folder mkdir dada_openapi_python cd dada_openapi_python 2. Create package folder A folder of dada open API client is being created in it. The name of this folder is intentionally different from that of the upper directory to avoid misunderstanding. This folder is actually the package name mkdir dada_openapi_clien ...

Posted on Tue, 07 Jan 2020 02:48:00 -0800 by jikishlove

Python crawler takes pictures and downloads them to local instance

Today, the editor will share an example of Python crawler getting pictures and downloading them to save in the local area. It has a good reference value and hopes to help you. Come and have a look!     1. Grab the pictures on the omelette website 2. The code is as follows * * * import urllib.request import os def url_open(url): req=u ...

Posted on Tue, 07 Jan 2020 02:30:14 -0800 by matthewod

The logging module in Python is encapsulated to record bug logs and log levels

Is the log generated by the program Programmer defined Output at the collector and channel level The role of logs and reports: The focus of the report is on the execution results (successful execution failure, how many use cases are covered), and the returned results The focus of the log is on the execution process, exception points, where to ...

Posted on Mon, 06 Jan 2020 09:47:34 -0800 by attock

openpyxl module encapsulation in Python, read and write automated test cases in Excel files

Often when we are summarizing automated tests, we place data in Excel files, CSV files, databases There are many modules in Python that handle excel data, such as xlxd (read-only), xlwd (write-only), openpyxl (read-write) We will use data-driven thinking, using load_workbook in openpyxl to process the data of existing Excel files, only read and ...

Posted on Mon, 06 Jan 2020 01:09:25 -0800 by dylan001

How to get the logical exclusive or of two variables in Python?

How to get the Logical difference Or? For example, I have two variables that I expect to be strings. I want to test that only one of them contains a True value (not None or an empty string): str1 = raw_input("Enter string one:") str2 = raw_input("Enter string two:") if logical_xor(str1, str2): print "ok" else: print "bad" ^Oper ...

Posted on Sun, 05 Jan 2020 08:53:18 -0800 by execute

Nginx implements static resources

PrefaceAs a high-performance server, nginx has many purposes. In addition to acting as a proxy for back-end servers and load balancing, there is also a purpose to act as a cache server for static resources. For example, in the projects separated from front-end and back-end, in order to speed up the response speed of front-end pages, we can put ...

Posted on Sun, 05 Jan 2020 05:23:03 -0800 by narch31