Most answered questions in Python

0 votes
1 answer

Convert the keys of a dictionary to list

Unpacking with * works with any object ...READ MORE

Feb 7, 2019 in Python by Omkar
• 69,230 points
338 views
0 votes
1 answer

Print a list in both ascending and descending order

You can use listName.sort(reverse=True). This will sort the ...READ MORE

Feb 7, 2019 in Python by Omkar
• 69,230 points
1,383 views
0 votes
1 answer

How can I lookup hostname using the IP address with a timeout in Python?

Good question. I actually was stuck with ...READ MORE

Feb 6, 2019 in Python by Nymeria
• 3,560 points
2,250 views
0 votes
1 answer

How can I read numbers in Python from a custom file?

Hi, good question. Let us first assume that ...READ MORE

Feb 6, 2019 in Python by Nymeria
• 3,560 points
868 views
0 votes
1 answer

Convert HTML to an image in Python

webkit2png. The original version is OSX-only, but luckily ...READ MORE

Feb 5, 2019 in Python by SDeb
• 13,300 points
17,351 views
0 votes
1 answer

How can i combine flask and nameko?

You absolutely can use nameko and Flask together.  In that ...READ MORE

Feb 5, 2019 in Python by SDeb
• 13,300 points
1,264 views
0 votes
1 answer

How to set a random seed for prn generation?

The main python module that is run ...READ MORE

Feb 4, 2019 in Python by charlie_brown
• 7,720 points
557 views
0 votes
1 answer

What is the process to kill a particular thread in python?

A multiprocessing.Process can p.terminate() In the cases where I want to ...READ MORE

Feb 4, 2019 in Python by charlie_brown
• 7,720 points
3,482 views
0 votes
1 answer

How to get path with filename in python?

There is no direct way to get ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
3,366 views
0 votes
1 answer

How to list only text files in a directory using python?

Well, you are using a complex way. ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
2,450 views
0 votes
1 answer

How to get absolute path in python?

Instead of using os.path.dirname method which returns the relative ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
7,601 views
0 votes
1 answer

How to list only files in a directory?

Before printing, you can use a check ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
423 views
0 votes
1 answer

How to list files/directories in python

You can use the os module to list the ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
559 views
0 votes
1 answer

How can I run terminal commands in python?

You can use the subprocess or os module to do this. Using ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
944 views
0 votes
1 answer

How to add integer to python array?

You have defined a numpy array but ...READ MORE

Feb 4, 2019 in Python by Omkar
• 69,230 points
5,146 views
0 votes
1 answer

Python AST with preserved comments

The ast module doesn't include comments. The ...READ MORE

Feb 2, 2019 in Python by SDeb
• 13,300 points
1,287 views
0 votes
1 answer

Weird closure behavior in python

Closures don't refer to variables but rather ...READ MORE

Feb 2, 2019 in Python by SDeb
• 13,300 points
592 views
0 votes
1 answer

Not able to take input in python

You are using python 2 in which ...READ MORE

Jan 31, 2019 in Python by Omkar
• 69,230 points
3,324 views
0 votes
1 answer

Need a python script to login into a website but username and password are in a txt file (Selenium automation script)

I had a similar requirement. I had ...READ MORE

Jan 31, 2019 in Python by Omkar
• 69,230 points
7,923 views
–1 vote
1 answer

nmap.nmap.PortScannerError: 'nmap program was not found in path

python-nmap module used in python happens to use nmap binary ...READ MORE

Jan 30, 2019 in Python by Omkar
• 69,230 points
14,696 views
0 votes
1 answer

Command 'pip' not found

Seems like python is installed in your ...READ MORE

Jan 30, 2019 in Python by Omkar
• 69,230 points
6,155 views
0 votes
1 answer

How to use an index to get an item?

What you show, ('A','B','C','D','E'), is not a ...READ MORE

Jan 30, 2019 in Python by SDeb
• 13,300 points
390 views
0 votes
1 answer

Shuffling a Word

You can try the following: import random word = ...READ MORE

Jan 30, 2019 in Python by SDeb
• 13,300 points
814 views
0 votes
1 answer

How can I have only positive decimal numbers in Django using Python?

Hi, are you aware of something called ...READ MORE

Jan 30, 2019 in Python by Nymeria
• 3,560 points
5,897 views
0 votes
1 answer

How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

Jan 30, 2019 in Python by Nymeria
• 3,560 points
16,822 views
0 votes
1 answer

How to find if setuptools is installed in python?

You can use python interpreter to check ...READ MORE

Jan 29, 2019 in Python by Omkar
• 69,230 points
1,707 views
0 votes
1 answer

How to find packages installed using pip?

Yes, you can find the packages installed ...READ MORE

Jan 29, 2019 in Python by Omkar
• 69,230 points
479 views
0 votes
1 answer

How to upgrade all packages using pip at once?

pip doesn’t have a default command for ...READ MORE

Jan 29, 2019 in Python by Omkar
• 69,230 points
1,254 views
0 votes
1 answer

socket.shutdown vs socket.close

Once a socket is no longer required, ...READ MORE

Jan 29, 2019 in Python by SDeb
• 13,300 points
2,969 views
0 votes
1 answer

How to create a GUID/UUID in Python

The uuid module, in Python 2.5 and ...READ MORE

Jan 29, 2019 in Python by SDeb
• 13,300 points
1,549 views
0 votes
1 answer

How do I check which files are open or closed in Python?

Hi, good question. I have a solution ...READ MORE

Jan 29, 2019 in Python by Nymeria
• 3,560 points
2,110 views
0 votes
1 answer

How to create and read from a temporary file in Python?

Hi, there is a very simple solution ...READ MORE

Jan 29, 2019 in Python by Nymeria
• 3,560 points
1,802 views
0 votes
1 answer

Python Linked List

Check out the following code. This might ...READ MORE

Jan 29, 2019 in Python by SDeb
• 13,300 points
455 views
0 votes
1 answer

Python if not == vs if !=

Using dis to look at the bytecode ...READ MORE

Jan 29, 2019 in Python by SDeb
• 13,300 points
780 views
0 votes
1 answer

Pyplot error "only size-1 arrays can be converted to Python scalars"

You can plot the chart by taking ...READ MORE

Jan 28, 2019 in Python by Omkar
• 69,230 points
9,179 views
0 votes
1 answer

Python logical operator 'and'

If you use and on two or ...READ MORE

Jan 28, 2019 in Python by Omkar
• 69,230 points
512 views
0 votes
1 answer

Need help with Django URL string parameter pattern in Python

Good question. The solution to this short ...READ MORE

Jan 28, 2019 in Python by Nymeria
• 3,560 points
621 views
0 votes
1 answer

Need help displaying complete output in Jupyter rather than just last result set in Python

Hi, the solution to this is very ...READ MORE

Jan 28, 2019 in Python by Nymeria
• 3,560 points
957 views
0 votes
1 answer

error while installing pyautoit

Hi @reddy!  According to the Python Documentation, Error code ...READ MORE

Jan 27, 2019 in Python by Omkar
• 69,230 points
1,464 views
0 votes
1 answer

Confusion in Python Pandas code

I have added the explanation of code ...READ MORE

Jan 26, 2019 in Python by Omkar
• 69,230 points
1,512 views
+1 vote
1 answer

What does the Raise keyword do in Python?

Hi! I think I can answer this - ...READ MORE

Jan 25, 2019 in Python by Nymeria
• 3,560 points
896 views
0 votes
1 answer

Need help referencing Python Package when the filename consists of a period key

Hi, it's a very simple answer actually.  You ...READ MORE

Jan 25, 2019 in Python by Nymeria
• 3,560 points
733 views
0 votes
1 answer

How to get rid of tensorflow verbose messages with Keras?

If you are using TensorFlow 0.12, you ...READ MORE

Jan 24, 2019 in Python by SDeb
• 13,300 points
4,294 views
0 votes
1 answer

No module named urllib3

It is possible that either urllib3 is ...READ MORE

Jan 24, 2019 in Python by SDeb
• 13,300 points
8,554 views
0 votes
1 answer

Need help using Joins in Pandas using Python

Hi, there is one scenario where the ...READ MORE

Jan 24, 2019 in Python by Nymeria
• 3,560 points
454 views
0 votes
1 answer

Need help with making use of Pluck in Python

Hi, good question. Easy solution to be ...READ MORE

Jan 24, 2019 in Python by Nymeria
• 3,560 points
1,472 views
0 votes
1 answer

How can I differentiate between column vectors and row vectors using Python?

Hi, good question. What you can do ...READ MORE

Jan 23, 2019 in Python by Nymeria
• 3,560 points
1,802 views
0 votes
1 answer

I am using a built-in function name as a method identifier and sometimes as an attribute in Python, is this bad?

Hi, good question. The thing is that ...READ MORE

Jan 23, 2019 in Python by Nymeria
• 3,560 points
566 views
0 votes
1 answer

Problem with module xlsxwriter

Even if it looks like the module ...READ MORE

Jan 23, 2019 in Python by charlie_brown
• 7,720 points
3,262 views
0 votes
1 answer

Size of an open file object

You can use the following and try ...READ MORE

Jan 22, 2019 in Python by SDeb
• 13,300 points
382 views