- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rajendra Dharmkar has Published 453 Articles
Rajendra Dharmkar
3K+ Views
There are multiple ways to get a list of locally installed Python modules. Easiest way is using the Python shell, for example, >>> help('modules') Please wait a moment while I gather a list of all available modules... BaseHTTPServer brain_nose markupbase ... Read More
Rajendra Dharmkar
5K+ Views
When you install Python, you also get the Python package manager, pip. You can use pip to get the versions of python modules. If you want to list all installed Python modules with their version numbers, use the following command:$ pip freezeYou will get the output:asn1crypto==0.22.0 astroid==1.5.2 attrs==16.3.0 Automat==0.5.0 backports.functools-lru-cache==1.3 ... Read More
Rajendra Dharmkar
1K+ Views
The "from module import function" statement is used to import a specific function from a Python module. For example, if you want to import the sin function from the math library without importing any other function, you can do it as follows:>>> from math import sin >>> sin(0) 0.0Note that ... Read More
Rajendra Dharmkar
1K+ Views
The "from module import *" statement is used to import all function from a Python module. For example, if you want to import all functions from math module and do not want to prefix "math." while calling them, you can do it as follows:>>> from math import * >>> sin(0) ... Read More
Rajendra Dharmkar
743 Views
To set the PYTHONPATH on Linux to point Python to look in other directories for the module and package imports, export the PYTHONPATH variable as follows:$ export PYTHONPATH=${PYTHONPATH}:${HOME}/fooIn this case, are adding the foo directory to the PYTHONPATH. Note that we are appending it and not replacing the PYTHONPATH's original ... Read More
Rajendra Dharmkar
1K+ Views
To set the PYTHONPATH on Mac OS to point Python to look in other directories for module and package imports, export the PYTHONPATH variable as follows:$ export PYTHONPATH=${PYTHONPATH}:${HOME}/foo In this case are adding the foo directory to the PYTHONPATH. Note that we are appending it and not replacing the PYTHONPATH's original ... Read More
Rajendra Dharmkar
760 Views
To set the PYTHONPATH on windows to point Python to look in other directories for module and package imports, go to:My Computer > Properties > Advanced System Settings > Environment VariablesThen under system variables edit the PythonPath variable. At the end of the current PYTHONPATH, add a semicolon and then ... Read More
Rajendra Dharmkar
97 Views
The zfill method is built for left padding zeros in a string. For example:>>> '25'.zfill(6) '000025'We can also use the rjust(width[, fillchar]) method in string class that right justifies the string and pads the left side with given filler char. The default filler char is space but we can provide ... Read More
Rajendra Dharmkar
9K+ Views
You can use the "from module import function" statement to import a specific function from a Python module. For example, if you want to import the sin function from the math library without importing any other function, you can do it as follows:>>> from math import sin >>> sin(0) 0.0Note ... Read More
Rajendra Dharmkar
582 Views
There are two ways to go about replacing \ with \ or unescaping backslash escaped strings in Python. First is using literal_eval to evaluate the string. Note that in this method you need to surround the string in another layer of quotes. For example:>>> import ast >>> a = '"Hello, ... Read More
To Continue Learning Please Login
Login with Google