Category: Python
-
Save wikipedia article in txt format with python and wikipedia API
For focus based study its essential to get rid of all unnecessary context like wonderful design, and other ui effect. Whats necessary only text like the text book. Wikipedia is one of my most visited website at this time. Though I love the content , i wll love more if its more minimalist.. So there…
-
Create your first chat application with Flask and Socketio
We will use socketio for real-time messaging First install our dependency for this application pip install flask pip install flask-socketio Copy Code How it will work. Every user will get an unique key. If the the other user submit the other users key that will send the message. its like sending message to unique username…
-
Ajax example with flask
One of the best ajax applied in real world is username checker. In this example we will check if there is existing username This is code /project we will Our first step: Check if username exists or not Imagine we have this existing username when the user enter a username we will check it from…
-
Solve Math Problems Instantly: Python’s eval() for Speedy String-Based Calculations
For example we have math expression in string like “4+2+34+346-234”We can directly calculate from this text with eval() Directly calculate from string our_expression= “4+2+34+346-234” answer=eval(our_expression) print(answer) # 152 Copy Code More things we can do calculate from variables x = 7 y = 5 expression = “x * y” result = eval(expression) print(“Result:”, result) #…
-
Flask testing environment ssl solution with “adhoc”
Why? When I started developing video calling application at one point I faced this situation. In single pc(on localhost 127.0.0.1) everything works very well but when I need to test another pc on the same network for example(wifi) . Before on public production environment I wanted to test my own private network which was established…
-
Simulate Bird Flocking Behavior with pygame: Algorithm and Code Explained
Bird flocking is a wonderful example of how simple behaviors can lead to complex, beautiful patterns in nature. We’ll learn the key principles behind this flocking behavior and write a python program to simulate this wonderful phenomenon. The principles Bird Flocking Simulation Algorithm Setting Up the Simulation Each Frame of the Simulation The pygame example…
-
MongoDB Indexing Basics with Python
MongoDB Improve performance Why you should use Indexing in Databases Faster Searches Indexes act as efficient lookup structures, enabling rapid retrieval of data matching query criteria. Optimized Query Execution By using indexes, databases can strategically navigate the data path, minimizing processing time for queries. Reduced Disk I/O Indexes allow the database to locate data directly,…
-
How to create, read and write csv file from python
First Lets talk about csv Its a plain text format which comes from (Comma Separated Values) Most spreadsheet application supports this. You can open and edit it from excl, Libra office cal , google sheets and other spread sheet application, also supported by most of the programming language. For simplicity and flexibility often used in…
-
How to generate requirements.txt in python
A requirements.txt file is essential for managing Python project dependencies. It ensures everyone working on your project has the correct libraries installed for development and deployment. The simplest way or automatically generate requirements.txt is using piprequs library. It will generate requairements.txt file based on the imports of your project. First install the library pip install…