Reversing a String in Python
Python | Reversing a String >>> x = 'PythonWorld' >>> print(x[: : -1]) dlroWnohtyP
What is the use of self in Python?
Python | Self Self is used to represent the instance of the class. With this keyword, you can access the attributes and methods of the class in python. It binds the attributes with the given arguments. …
what are the features available in Django?
Django | Features Features available in Django are Optimized for SEO Extremely fast A loaded framework that features authentications, content administrations and RSS feeds Exceptionally scalable to meet the heaviest traffic demand Highly secure Versatility, …
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 …
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~
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
How to obtain the SQL query from the queryset?
Using the query method we can print SQL query from the queryset post = Post.objects.all() print(post.query)
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
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 …
Does Python support interfaces like Java does?
No. However, Abstract Base Classes (ABCs) are a feature from the abc module that let us declare what methods subclasses should implement. Python supports this module since version 2.7.
Can you explain the filter(), map(), and reduce() functions?
Python | filter(), map(), and reduce() Functions filter() function accepts two arguments, a function and an iterable, where each element of the iterable is filtered through the function to test if the item is accepted or …
What is the use of vars(), dir() and help() functions?
Python | vars(), dir() and help() The vars() function returns the __dict__ attribute of an object. The dir() function returns all properties and methods of the specified object, without the values. The help() function is used to display …
Explain the difference between @staticmethod and @classmethod?
Python | Difference between @staticmethod and @classmethod A staticmethod is a method that knows nothing about the class or the instance it was called on. It just gets the arguments that were passed, no implicit first argument. …
Does Django support NoSQL?
Django | NoSQL NoSQL basically stands for “not only SQL”. This is considered an alternative to the traditional RDBMS or relational Databases. Officially, Django does not support NoSQL databases. However, there are third-party projects, such as …