Python check the memory usage of an object
Python | Check the memory usage of an object >>> import sys >>> x = 100 >>> print(sys.getsizeof(x)) 28
Python Print String N times
Python | Print String N times >>> s = 'Python' >>> n = 5 >>> print(s * n) PythonPythonPythonPythonPython
python return multiple values from functions
Python | Return multiple values from functions >>> def A(): return 2, 3, 4 >>> a, b, c = A() >>> print(a, b, c) 2 3 4
Python join all items of a list to convert into a single string
Python | Join all items of a list to convert into a single string >>> x = ["Python", "Online", "Training"] >>> print(" ".join(x)) Python Online Training
Reversing a String in Python
Python | Reversing a String >>> x = 'PythonWorld' >>> print(x[: : -1]) dlroWnohtyP
Python In-place swapping of two numbers
Python | In-place swapping of two numbers >>> a, b = 10, 20 >>> print(a, b) 10 20 >>> a, b = b, a >>> print(a, b) 20 10
Undo the most recent local commits in git
Git | Undo the most recent local commits Bellow command is used to reset the last local commit. git reset HEAD~
What are static files in Django? And how can you set them?
In Django, static files are the files that serve the purpose of additional purposes such as images, CSS, or JavaScript files. Static files managed by “django.contrib.staticfiles”. There are three main things to set up static …
Explain Django's code reusability.
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 …
What architecture does Django use?
Django follows a Model-View -Template (MVT) architecture which is a variant of the MVC architecture. Model: Logical data structure behind the entire app and signified by a database. A model is used in Django to …
Set path and environment variables in Windows 11
Windows | Set path and environment variables in Windows 11 Press the + to access the Power User Task Menu. In the Power User Task Menu, select the System option. In the System window, scroll to the bottom and click the About option. In the System …
Set path and environment variables in Windows 2000 and Windows XP
Windows | Set path and environment variables in Windows 2000 and Windows XP On the desktop, right-click the Computer icon and select Properties. or Press the and right-click the Computer option in the Start menu, and select Properties. In the System Properties window, click the Advanced tab. In the Advanced tab, click …
Set path and environment variables in Windows Vista and Windows 7
Windows | Set path and environment variables in Windows Vista and Windows 7 On the desktop, right-click the Computer icon and select Properties. or Press the and right-click the Computer option in the Start menu, and select Properties. Click the Advanced System Settings link in the left column. In …
Set path and environment variables in Windows 8
Windows | Set path and environment variables in Windows 8 Press the + to access the Power User Task Menu Now, select the System option. Click the Advanced System Settings link in the left column. In the Advanced tab, click the button. In the Environment Variables window highlight …
List the common security issues that can be avoided by using Django?
A few common security issues that can be avoided by using Django are: Clickjacking Cross-site scripting and SQL injection