Easy Code Share > Python

Python Parallel for Loop on Producer-consumer Model

Python Parallel for Loop on Producer-consumer Model

Python parallel for loop can simplify the producer-consumer model, and we provide a simple Python example that uses the async thread module, asyncio, for demonstration. The example simulates the behaviors of restaurant’s cookers and their customers. Briefly, Python language provides a quick method to execute for loop in parallel that meets the feature of such … Read more

Easy Code Share > Python

Solving Post JSON to Python CGI FieldStorage Error

Solving Post JSON to Python CGI FieldStorage Error

Python CGI module gets popular among developers for only unstructured data, but its FieldStorage() gives rise to an error for posting JSON data. The article describes the problem in details and raise a solution. You should configure Apache CGI on Windows or Linux before studying this topic, because practices make perfect. All codes here are … Read more

Easy Code Share > Python

Googletrans Python Example for A French Chatbot

Googletrans Python Example for A French Chatbot

The Googletrans Python library can implement multilingual chatbot examples such as a French chatbot. In general, the French stemmer, one of NLTK(Natural Language Toolkit) Snowball Stemmers, is able to parse French sentences and phases to achieve a French chatbot. Alternatively, we provide here another approach and will tell you the reason. Although the NLTK Snowball … Read more

Easy Code Share > Python

NLP Chatbot Deep Learning by Tensorflow and NLTK

NLP Chatbot Deep Learning by Tensorflow and NLTK

NLP chatbot can wisely acts as a person in charge of customer service, and we want to concisely reveal the secret of AI(Artificial Intelligence) chatbot by introducing the deep machine learning with Tensorflow and NLTK in Python. By definition, NLP(Natural Language Processing) is the process that chatbot is able to understand what human is talking … Read more

Easy Code Share > Python

WSGI App in Python under Apache mod_wsgi

WSGI App in Python under Apache mod_wsgi

Walking through an example, you will learn how to install and configure mod_wsgi on Apache, and enable a Python wsgi app. Accordingly, the app accepts GET and POST data and replies with text, html or json data. Unfortunately, the ways to retrieval of GET and POST parameters from mod_wsgi are different. But when you understand … Read more

Easy Code Share > Python

Python HTTP Server Accept File Upload in Two Ways

Python HTTP Server Accept File Upload in Two Ways

Upon Apache CGI, Python scripts play the role of HTTP web server that accepts both single and multiple file upload. In the article, first, we review methods of file upload in HTML browser, and then focus on Python scripts about how to receive and store files. All codes here are not complicated, so you can … Read more

Easy Code Share > Python

Scraping Three Global Weather Channels by Tricks

Scraping Three Global Weather Channels by Tricks

Using web scraping techniques to add a weather crawler module in your apps can help users to crawl temperature and more weather info as they want. For weather inquiry, you can call weather APIs provided by Bureau of Meteorology, or crawl Google and some weather channels. All codes here are not complicated, so you can … Read more

Easy Code Share > Python

Telegram Bot API Send Weather Message by Python

Telegram Bot API Send Weather Message by Python

Based on the example of a Telegram weather bot, let us learn how Python scripts send messages to apps by using Telegram API. The procedural steps are made up of registering a bot, creating a daemon process for the bot, and handling requests with the help of web crawling skills. All codes here are not … Read more

Easy Code Share > Python

MySQL Crud by Python DB Class and Error Handling

MySQL Crud by Python DB Class and Error Handling

We are introducing a Python DB class for helping your coding. In Python programming, MySQL connection and CRUD operations seem common, but have risks inside because of potential exceptions. Our open-source database class allows you to derive a child class, customize the child class, and, importantly, handle exceptions to reduce risks. Let’s begin with the … Read more

Easy Code Share > Python

Python Webapp Demo on Apache CGI for Windows

Python Webapp Demo on Apache CGI for Windows

For Python webapp scripts to run, we enumerate the most concise steps to Apache CGI configuration on Windows and Linux. The JS scripts in browser clients request not only PHP scripts on server sites, but also more competitive services from Python data science and AI. We will guide you on developing mode in Windows, and … Read more