Django | Set up Database We need to edit the setting.py file present in the project, which contains all the settings related to the project. By default Django comes with an SQLite database; The  SQLite database …

Last updated 1 year, 8 months ago | 356 views

Tags:- Django

List the inheritance styles in Django There are three possible inheritance styles in Django, and they are: Abstract Base Classes: This is used when we want to make the parent class hold the information which …

Last updated 1 year, 8 months ago | 395 views

Tags:- Django

Difference between Python array and Python list Array Lists it is used to store only homogeneous data. The list is used to store heterogeneous data it occupies less amount of memory as the array stores …

Last updated 1 year, 8 months ago | 372 views

Tags:- Python

Python program to count the number of capital letters in a file. with open(FILE_NAME) as my_file: count = 0 text = my_file.read() for character in text: if character.isupper(): count += 1 print(count)    

Last updated 1 year, 8 months ago | 408 views

Tags:- Python

Python | Inheritance  Inheritance is a process by which a class can inherit the methods and properties of another class. The concept of inheritance provides the idea of reusability. The class from which we are inheriting is …

Last updated 1 year, 8 months ago | 422 views

Tags:- Python

[::-1] is used to inverse the order of a sequence. >>> my_list = [1,2,3,5,6,7,8,9] >>> my_list[::-1] [9, 8, 7, 6, 5, 3, 2, 1]    

Last updated 1 year, 8 months ago | 365 views

Tags:- Python

Python | ‘is’, ‘not’, and ‘in’ operators is: Returns True if both variables are the same object >>> x = 5 >>> y = 5 >>> z = 1 >>> x is y True >>> x …

Last updated 1 year, 8 months ago | 343 views

Tags:- Python

The .py files are the python source code of a program. While the .pyc files contain the bytecode of the python files. We get bytecode after compilation of .py file (source code). The .pyc files are not …

Last updated 1 year, 8 months ago | 467 views

Tags:- Python

We can use the python re module to match the string import re def check(txt): # regex pattern pattern = 'ab{4,8}' if re.search(pattern, txt): print('Match found') else: print('Match not found') check("abcbbbb") # Match not found check("aabbbbbc") # …

Last updated 1 year, 8 months ago | 415 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 1 year, 8 months ago | 372 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 1 year, 8 months ago | 395 views

Tags:- Python

Python | What are decorators A decorator in Python is a function that modifies the behavior of an existing function or class without any modification to the original source code.  A decorator takes another function as its argument and returns yet …

Last updated 1 year, 8 months ago | 381 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 1 year, 8 months ago | 381 views

Tags:- Python

Django | Set up environment variables in Django   1. Install Django Environ In your terminal, inside the project directory, type: $ pip install django-environ 2. Import environ in settings.py import environ 3. Initialise environ …

Last updated 1 year, 8 months ago | 449 views

Tags:- Django

Windows | Set path and environment variables in Windows 10 Press the + to access the Power User Task Menu. Now, select the System option. In the About window, click the Advanced system settings link under Related settings from the right side. In the Advanced tab, click the  button. In …

Last updated 1 year, 8 months ago | 420 views

Tags:- Windows