Trending questions in Python

0 votes
1 answer

What does [:] mean?

It's a slicing, and what it does ...READ MORE

Jan 16, 2019 in Python by SDeb
• 13,300 points
2,292 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,210 points
1,707 views
0 votes
3 answers

What is the python keyword “with” used for?

The with statement in Python simplifies exception ...READ MORE

Jul 19, 2019 in Python by rahul
• 360 points
1,215 views
0 votes
1 answer

How to use multiprocessing queue in Python?

This is a simple example of a ...READ MORE

Oct 25, 2018 in Python by SDeb
• 13,300 points
5,779 views
0 votes
2 answers

How to add a certain time delay to the code using Python?

You can use time.sleep(duration in second) READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
875 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 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 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,799 views
0 votes
1 answer

What is the equivalent of NotImplementedError using Python?

Hi, good question! One simple answer to your ...READ MORE

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

Best way to open a socket in Python

Opening sockets in python is pretty simple. ...READ MORE

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

Signed angle between vectors

If you have an atan2() function in ...READ MORE

Dec 11, 2018 in Python by SDeb
• 13,300 points
3,611 views
0 votes
1 answer

Python program to read the excel file which contains more than 65K records

Hi @Rashmi! I read your code and there ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,210 points
1,039 views
0 votes
1 answer

Is there a Python equivalent to `perl -pi -e`?

The command line usage from 'python -h' ...READ MORE

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

How to increase plt.title font size?

Try the following : import matplotlib.pyplot as plt plt.figtext(.5,.9,'Temperature', ...READ MORE

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

Need help checking the validity of an image file in Python

I went through the Python documentation and ...READ MORE

Jan 18, 2019 in Python by Nymeria
• 3,560 points
1,939 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

Embed R code in python

You can try this : from rpy import ...READ MORE

Feb 11, 2019 in Python by SDeb
• 13,300 points
858 views
–1 vote
1 answer

Pyspark rdd How to get partition number in output ?

The glom function is what you are looking for: glom(self): ...READ MORE

Jan 8, 2019 in Python by Omkar
• 69,210 points
2,319 views
–1 vote
1 answer

Python convert excel file to csv

Here you go: import glob path_to_excel_files = glob.glob('path/to/excel/files/*.xlsx') for ...READ MORE

Feb 8, 2019 in Python by Omkar
• 69,210 points
975 views
0 votes
1 answer

Graphviz vs PyGraphViz

graphviz is lightweight library which calls graphviz ...READ MORE

Jan 9, 2019 in Python by ana1504.k
• 7,910 points
2,237 views
0 votes
1 answer

How can I make use of getopt or optarg in Python?

Hi, I was asked this by one ...READ MORE

Feb 8, 2019 in Python by Nymeria
• 3,560 points
944 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,210 points
1,464 views
0 votes
1 answer

Does Python's time.time() return the local or UTC timestamp?

The time.time() function returns the number of seconds since ...READ MORE

Nov 14, 2018 in Python by charlie_brown
• 7,720 points
4,645 views
0 votes
1 answer

What is .pydistutils.cfg?

I don't immediately see a reason why ...READ MORE

Jan 21, 2019 in Python by SDeb
• 13,300 points
1,697 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,210 points
1,512 views
0 votes
1 answer

How to enable python3 in vim?

You didn't tell us the platform you're ...READ MORE

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

K-means or Hierarchical clustering?

You can use hierarchical clustering for this ...READ MORE

Feb 14, 2019 in Python by Dinesh
660 views
0 votes
1 answer

Path separator char in Python

There is an alternative way. you can ...READ MORE

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

Need help understanding python code

In this particular code, I think you ...READ MORE

Feb 19, 2019 in Python by Omkar
• 69,210 points
386 views
0 votes
1 answer

Shorter way to write a Python for loop

You can use the enumerate iterator: for i, ...READ MORE

Jan 17, 2019 in Python by SDeb
• 13,300 points
1,805 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,210 points
1,252 views
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

Jan 2, 2019 in Python by Omkar
• 69,210 points
2,422 views
0 votes
1 answer

Python inheritance: TypeError: object.__init__() takes no parameters

You are calling the wrong class name ...READ MORE

Nov 15, 2018 in Python by Nymeria
• 3,560 points
4,502 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,467 views
0 votes
0 answers

'module' object has no attribute 'PortScanner'

I am trying to run nmap in ...READ MORE

Jan 30, 2019 in Python by Karan
1,225 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
0 answers

How can I update Git Code into a Docker container directly?

Hi all, with regard to the above ...READ MORE

Jan 22, 2019 in Python by Anirudh
• 2,080 points
1,541 views
+3 votes
1 answer

Tensorflow 1.5 ImportError: No module named tensorflow.python.client

I think it's a bug in Tensorflow ...READ MORE

Sep 25, 2018 in Python by charlie_brown
• 7,720 points
6,593 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,210 points
943 views
0 votes
1 answer

How can I go about using var == False in Python?

Hi. Simple answer.  All you need to do ...READ MORE

Feb 13, 2019 in Python by Nymeria
• 3,560 points
507 views
+1 vote
2 answers

Measuring the distance between pixels on OpenCv with Python

You can try this: Mat pts1(nPts, 1, CV_8UC2), ...READ MORE

Aug 24, 2018 in Python by Omkar
• 69,210 points
10,177 views
0 votes
1 answer

Empty while loop in Python

while file.readline().startswith("#"):     pass The pass statement does nothing. It ...READ MORE

Dec 5, 2018 in Python by SDeb
• 13,300 points
3,484 views
0 votes
1 answer

how to read a JSON from a file?

You can use with statement with open('strings.json') as ...READ MORE

Oct 24, 2018 in Python by Priyaj
• 58,090 points
5,295 views
0 votes
2 answers

Why do we use return statement in python?

def maximum(x, y):     if x > y:     ...READ MORE

Apr 4, 2019 in Python by anonymous
1,745 views
0 votes
1 answer

How to solve indentation in the below code?

Python does not use brackets, it uses ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,210 points
517 views
0 votes
1 answer

Problem while using local dynamoDB container (Boto3 put_item error)

DynamoDB does not autogenerate the ID when ...READ MORE

Dec 3, 2018 in Python by charlie_brown
• 7,720 points
3,443 views
0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

Apr 2, 2019 in Python by anonymous
5,390 views
0 votes
1 answer

Number of private variables in class

In Python, there is no existence of ...READ MORE

Feb 13, 2019 in Python by Prateek
297 views
0 votes
0 answers

how to get mongoengine object id in flask program

i am using mongoengine to integrate with ...READ MORE

Oct 5, 2018 in Python by eatcodesleeprepeat
• 4,710 points
5,998 views
0 votes
0 answers