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, 3 months ago | 1903 views

Tags:- Python

Windows | Add desktop icon windows 10 1. Right-click on the desktop and click on Personalization   2. Under Personalization > Themes > Related Settings, select Desktop icon settings.   3. Choose the icons you would like to have on your …

Last updated 4 years, 8 months ago | 1901 views

Tags:- Windows

Python | Iterator | (__iter__ and __next__) Iterators are objects that can be iterated upon. The iterator protocol for Python declares that we must make use of two functions to build an iterator- iter() and next().   …

Last updated 4 years, 3 months ago | 1899 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 4 years, 1 month ago | 1895 views

Tags:- Python

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

Last updated 4 years, 3 months ago | 1885 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, 3 months ago | 1864 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, 3 months ago | 1862 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 4 years, 1 month ago | 1859 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, 3 months ago | 1855 views

Tags:- Python

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, 3 months ago | 1854 views

Tags:- Django

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 4 years, 1 month ago | 1854 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 4 years ago | 1854 views

Tags:- Django

Once you've created a table in your Microsoft SQL Server (MSSQL) database, the next step is inserting data into it. Python, combined with the pyodbc library, offers a powerful and flexible way to insert data …

Last updated 1 year, 4 months ago | 1844 views

Tags:- Python MSSQL

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, 3 months ago | 1844 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 4 years, 1 month ago | 1840 views

Tags:- Python