Python | zip() Function Python zip() function returns a zip object, which maps a similar index of multiple containers. It takes an iterable, converts it into an iterator, and aggregates the elements based on the iterable passed. …

Last updated 4 years, 1 month ago | 1857 views

Tags:- Python

Django | Request/Response Cycle Whenever a request is received by the Django server. The Request is processed by various middlewares and is passed to the URL Router. Then, the server looks for a matching URL in the urlpatterns …

Last updated 4 years, 1 month ago | 1841 views

Tags:- Django

Python | Delete a file Using command  os.remove(file_name)   Use the os module to delete a file, we need to first import it, and then use the remove() function provided by the module to delete the file. It …

Last updated 4 years, 1 month ago | 1837 views

Tags:- Python

If bool(a) returns False, then x is assigned the value of b.

Last updated 4 years, 1 month ago | 1831 views

Tags:- Python

You can do this by converting the list to a set using the set() method and comparing the length of this set with the length of the original list. If found equal, return True else …

Last updated 3 years, 11 months ago | 1831 views

Tags:- Python

Python | swapcase() Function It is a string's function that converts all uppercase characters into lowercase and vice versa. It automatically ignores all the non-alphabetic characters.   string = "IT IS IN LOWERCASE." print(string.swapcase())  

Last updated 4 years, 1 month ago | 1829 views

Tags:- Python

Python | Pickling, and Unpickling The pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using the dump function, this process is called pickling. …

Last updated 4 years, 1 month ago | 1821 views

Tags:- Python

We can use the Counter method from the collections module from collections import Counter dict1 = {'a': 5, 'b': 3, 'c': 2} dict2 = {'a': 2, 'b': 4, 'c': 3} new_dict = Counter(dict1) + Counter(dict2) …

Last updated 3 years, 11 months ago | 1818 views

Tags:- Python

Python | accessors, mutators, and @property What we call getters and setters in languages like Java, we term accessors and mutators in Python. In Java, if we have a user-defined class with the property ‘x’, we …

Last updated 4 years, 1 month ago | 1817 views

Tags:- Python

Python | enumerate() Function The enumerate() function is used to iterate through the sequence and retrieve the index position and its corresponding value at the same time.   lst = ["A","B","C"] print (list(enumerate(lst))) #[(0, 'A'), (1, 'B'), …

Last updated 4 years, 1 month ago | 1800 views

Tags:- Python

Compared to other frameworks, Django offers more code reusability. As Django is a combination of apps, copying those apps from one directory to another with some tweaks to the settings.py file won't need much time …

Last updated 3 years, 11 months ago | 1792 views

Tags:- Django

Some of the more well-known companies that make use of Django are:’ Instagram Mozilla Firefox Reddit YouTube Disqus Bitbucket Spotify NASA Pinterest Eventbrite, etc.

Last updated 4 years, 1 month ago | 1788 views

Tags:- Django

MRO stands for Method Resolution Order. Talking of multiple inheritances, whenever we search for an attribute in a class, Python first searches in the current class. If found, its search is satiated. If not, it …

Last updated 4 years, 1 month ago | 1787 views

Tags:- Python

Python | What are unit tests Unit test is a testing technique to check a single component of code and ensures that it performs as expected. Unit tests are an important part of regression testing to ensure that …

Last updated 3 years, 11 months ago | 1776 views

Tags:- Python

PEP stands for Python Enhancement Proposal. A PEP is an official design document that describes new features proposed for Python and documents aspects of Python, like design and style, for the community. PEP 8 exists to …

Last updated 4 years, 1 month ago | 1776 views

Tags:- Python