Trending questions in Python

0 votes
1 answer

How to get textual output when using exceptions in Python?

Hi, the answer is pretty simple.  Without the ...READ MORE

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

What is the recommended way to randomize a list of strings using Python?

Hi. Nice question. Here is the simplified answer ...READ MORE

Jan 18, 2019 in Python by Nymeria
• 3,560 points
938 views
0 votes
2 answers

Help me solve the code

The fetchone() method fetches the result of ...READ MORE

Jan 9, 2019 in Python by Omkar
• 69,220 points
1,022 views
0 votes
1 answer

freopen() in python

sys.stdout is simply file object, so, you ...READ MORE

Jan 3, 2019 in Python by anonymous
1,521 views
0 votes
1 answer

How to check latest change time of each file using glob in python?

You can get the changing time from ...READ MORE

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

Understanding repr( ) function in Python

>>> x = 'foo' >>> x 'foo' So the name x is ...READ MORE

Sep 17, 2018 in Python by Priyaj
• 58,020 points
6,188 views
0 votes
1 answer

Pycharm warning: Must implement all abstract methods in Python. Why?

n vote As expected, python itself recognises that ...READ MORE

Nov 9, 2018 in Python by Nymeria
• 3,560 points
3,857 views
–1 vote
1 answer

How to calculate difference in timestamp columns?

First, write the data in a csv file. Then ...READ MORE

Jan 19, 2019 in Python by Omkar
• 69,220 points
851 views
0 votes
1 answer

Python equivalent for static variables within a function?

You can use the following code, that ...READ MORE

Oct 17, 2018 in Python by Priyaj
• 58,020 points
4,840 views
0 votes
2 answers

How do I connect to a MySQL Database in Python?

connect mysql database with python import MySQLdb db = ...READ MORE

Mar 28, 2019 in Python by rajesh
• 1,270 points
1,893 views
0 votes
2 answers

Error: Speech to Text Codec cannot decode the bytes in position

import speech_recognition as sr r = sr.Recognizer() audio ='C\Users\Desktop\audiofile1.wav' with ...READ MORE

Nov 28, 2018 in Python by Nabarupa Das
2,947 views
0 votes
0 answers

Is there any module in Python that I can use for Wiki markup?

Hi all, simple question. Is there any ...READ MORE

Jan 22, 2019 in Python by Anirudh
• 2,090 points
616 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
520 views
0 votes
1 answer

How to use Euler's number and power operation?

You can refer the math library of ...READ MORE

Dec 31, 2018 in Python by SDeb
• 13,300 points
1,438 views
0 votes
1 answer

Is there any way to write native apps for Windows, Blackberry, Android and Apple devices using Python?

Hi, This is an amazing Python framework just ...READ MORE

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

How can I use indices in math using python

Operator ^ is a bitwise operator, which does "bitwise exclusive or". More: http://wiki.python.org/moin/BitwiseOperators The ...READ MORE

Dec 11, 2018 in Python by aryya
• 7,460 points
2,260 views
0 votes
1 answer

How to install OpenCV for python3 in Ubuntu?

I found this: https://pypi.python.org/pypi/opencv-python OpenCV on wheels 'Unofficial OpenCV packages ...READ MORE

Nov 28, 2018 in Python by Nymeria
• 3,560 points
2,818 views
0 votes
1 answer

Make a unix alias with python script

The scope of an alias command is the shell ...READ MORE

Sep 20, 2018 in Python by Priyaj
• 58,020 points
5,786 views
0 votes
1 answer

How do you get the logical xor of two variables in Python?

If you're already normalizing the inputs to ...READ MORE

May 29, 2018 in Python by aryya
• 7,460 points
10,678 views
0 votes
1 answer

How can I define a multidimensional array in python using ctype?

Here's one quick-and-dirty method: >>> A = ((ctypes.c_float ...READ MORE

Oct 9, 2018 in Python by aryya
• 7,460 points
4,891 views
0 votes
1 answer

Why there is no do while loop in python

There is no do...while loop because there ...READ MORE

Aug 6, 2018 in Python by Priyaj
• 58,020 points
7,660 views
0 votes
1 answer

ProgrammingError: not all arguments converted during string formatting

Sorted!!!! just found the solution, 1 - apparently ...READ MORE

Sep 20, 2018 in Python by Priyaj
• 58,020 points
5,697 views
0 votes
1 answer

Python Print lines for the closest timestamp of the event

Try this: import re import os import datetime from datetime import ...READ MORE

Jan 2, 2019 in Python by Omkar
• 69,220 points
1,177 views
0 votes
0 answers

How to implement multiple try codes in a single block using Python?

Hi all, As per the title, I am ...READ MORE

Jan 14, 2019 in Python by Anirudh
• 2,090 points
671 views
0 votes
1 answer

How to traverse from a file to parse another file?

You use os.walk() module of python for ...READ MORE

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

How to download intext images with beautiful soup

Ohh... I got what you need. Try this: html_data ...READ MORE

Sep 20, 2018 in Python by Priyaj
• 58,020 points
5,570 views
0 votes
1 answer

difference between lists and sets

There are a lot more differences such ...READ MORE

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

Django form validation: making “required” conditional?

This is done with the clean method on the ...READ MORE

Aug 30, 2018 in Python by Priyaj
• 58,020 points
6,399 views
0 votes
1 answer

How to break for loop in an if statement

You can break out of each loop ...READ MORE

Nov 16, 2018 in Python by Jino
• 5,820 points
3,019 views
0 votes
1 answer

What is the meaning of “int(a[::-1])” in Python?

Assumming a is a string. The Slice ...READ MORE

Aug 27, 2018 in Python by Priyaj
• 58,020 points
6,477 views
0 votes
1 answer

How to sort Counter by value using python?

Use the Counter.most_common() method, it'll sort the items for you: >>> ...READ MORE

May 23, 2018 in Python by charlie_brown
• 7,720 points
10,652 views
+3 votes
2 answers

Compiled vs Interpreted Languages

Compiled languages are written in a code ...READ MORE

Dec 3, 2018 in Python by allenvarna
• 540 points
5,777 views
+2 votes
1 answer

How can I record the X,Y limits of a displayed X,Y plot using the matplotlib show() module?

A couple hours after posting this question ...READ MORE

Dec 27, 2018 in Python by anonymous
1,151 views
0 votes
1 answer

popen.communicate in Python

Your second bit of code starts the ...READ MORE

Nov 13, 2018 in Python by Priyaj
• 58,020 points
3,051 views
0 votes
1 answer

Need help installing easy_install in Python 2.7.1 on Windows 7

That tool is part of the setuptools ...READ MORE

Dec 26, 2018 in Python by Nymeria
• 3,560 points
1,202 views
0 votes
1 answer

Declare variable without assigning any value in Python?

var = None Python is dynamic, so you ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,020 points
3,684 views
0 votes
1 answer

Avoid killing children when parent process is killed

I would recommend against your design as ...READ MORE

Sep 7, 2018 in Python by Priyaj
• 58,020 points
5,910 views
+3 votes
5 answers

is python compatible with Linux?

Just follow these three commands and you ...READ MORE

Sep 12, 2018 in Python by charlie_brown
• 7,720 points
2,164 views
0 votes
1 answer

Measuring the distance between pixels on OpenCv with Python

Assuming input frames will have "close to ...READ MORE

Sep 11, 2018 in Python by Priyaj
• 58,020 points
5,707 views
0 votes
1 answer

How do I determine if my python shell is executing in 32bit or 64bit mode on OS X?

UPDATED: One way is to look at sys.maxsize as ...READ MORE

Dec 11, 2018 in Python by aryya
• 7,460 points
1,764 views
+1 vote
2 answers

Does 'finally' always execute in Python?

The "finally" executes almost everytime. But there ...READ MORE

Aug 31, 2018 in Python by Omkar
• 69,220 points
6,060 views
–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

Mar 29, 2019 in Python by rajesh
• 1,270 points
2,119 views
+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
4,885 views
+1 vote
2 answers

Python string formatting: % vs. .format

Using Python format() function is what the ...READ MORE

Apr 11, 2019 in Python by Dasa Ravi
1,409 views
0 votes
1 answer

How to parse date/time string with timezone abbreviated name in Python?

The parse() function in dateutil can't handle ...READ MORE

Nov 27, 2018 in Python by Nymeria
• 3,560 points
2,268 views
0 votes
0 answers

Creating a mini language parser using Python

I'm planning to create a simple mini-language ...READ MORE

Dec 27, 2018 in Python by Anirudh
• 2,090 points
980 views
0 votes
0 answers

How to read lines from compressed text files in Python

Is it easy to read a line ...READ MORE

Dec 27, 2018 in Python by Anirudh
• 2,090 points
971 views
0 votes
3 answers

How to get the current time in Python

FOLLOWING WAY TO FIND CURRENT TIME IN ...READ MORE

Apr 8, 2019 in Python by rajesh
• 1,270 points
2,080 views
0 votes
1 answer

Read & write data in mifare card

Hi, you can check out the following ...READ MORE

Nov 29, 2018 in Python by SDeb
• 13,300 points
2,094 views
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

Sep 22, 2018 in Python by SDeb
• 13,300 points
5,040 views