Most viewed questions in Python

0 votes
1 answer

Python: Glob() to find files recursively

import os, fnmatch def find_files(directory, pattern): ...READ MORE

Oct 24, 2018 in Python by Priyaj
• 58,090 points
1,319 views
0 votes
1 answer

pip install mysql-python fails with EnvironmentError: mysql_config not found

It seems mysql_config is missing on your ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,910 points
1,315 views
0 votes
1 answer

How to run django unit-tests on production database in Python?

In case someone googles here searching for ...READ MORE

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

How to Import a module from a relative path?

If i understand your question correct then ...READ MORE

Dec 14, 2020 in Python by Tanja84DK

edited Dec 15, 2020 1,313 views
0 votes
1 answer

Python code for motion detection

Hey, @Sushruth, Here the code goes for Motion Detector.py import ...READ MORE

Nov 27, 2020 in Python by Gitika
• 65,910 points
1,313 views
0 votes
1 answer

HTML to RTF string using Pandoc(pypandoc)

Hey, @There, Actually there is a simple solution: use ...READ MORE

May 27, 2020 in Python by Gitika
• 65,910 points
1,311 views
0 votes
0 answers

TypeError: 'NoneType' object is not iterable in Python

What does this error mean?  I get this ...READ MORE

May 5, 2022 in Python by Kichu
• 19,050 points
1,310 views
0 votes
1 answer

Key error in Python

A KeyError occurs when the Key doesn't ...READ MORE

Sep 20, 2018 in Python by SDeb
• 13,300 points
1,310 views
0 votes
1 answer

How can I open multiple files using “with open” in Python?

Hello, Just replace and with , and you're done: try: ...READ MORE

Nov 20, 2020 in Python by Niroj
• 82,880 points
1,305 views
0 votes
1 answer

How to convert html to pdf in django

Hello @karthik , You can refer this for your ...READ MORE

Sep 21, 2020 in Python by Niroj
• 82,880 points
1,303 views
+1 vote
2 answers

How to resize the image canvas to maintain a square aspect ratio

down voteacceptedUsing OpenCVYou can use resize() in OpenCV to ...READ MORE

Apr 4, 2018 in Python by charlie_brown
• 7,720 points

edited Jul 11, 2023 by Khan Sarfaraz 1,303 views
0 votes
1 answer

Error:Render form errors with the label rather than field name

Hello @kartik, There is a simple way to ...READ MORE

Apr 29, 2020 in Python by Niroj
• 82,880 points
1,298 views
0 votes
1 answer

Create a nested directory in Python

Try os.path.exists, and consider os.makedirs for the ...READ MORE

Oct 16, 2018 in Python by SDeb
• 13,300 points
1,295 views
0 votes
1 answer

When is the perfect time to use Tornado in python?

There is a server and a webframework. ...READ MORE

Feb 14, 2019 in Python by aryya
• 7,450 points
1,292 views
0 votes
1 answer

How can I disable the Django Celery admin modules?

Hello @kartik, To be more specific, in admin.py of any ...READ MORE

Jun 12, 2020 in Python by Niroj
• 82,880 points
1,290 views
0 votes
1 answer

Sort Counter by value? - python

>>> x = Counter({'a':1, 'b':2, 'c':3}) >>> ...READ MORE

Nov 13, 2018 in Python by Priyaj
• 58,090 points
1,290 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,289 views
+1 vote
1 answer

Python: Print variable and string in same line

For a better understanding you can refer ...READ MORE

Oct 30, 2018 in Python by Priyaj
• 58,090 points
1,288 views
0 votes
1 answer

How to install and use myql connector in Python?

You can use pip to search if ...READ MORE

Jul 5, 2019 in Python by Neel
• 3,020 points
1,287 views
0 votes
1 answer

How to print colored text in Python?

This somewhat depends on what platform you ...READ MORE

Dec 17, 2020 in Python by Gitika
• 65,910 points
1,280 views
0 votes
1 answer

How to read data from a text file using Python?

Refer to the below example where the ...READ MORE

May 13, 2019 in Python by Sushma
1,280 views
0 votes
1 answer

Is it possible to access .NET code written in C# from Python?

If you want to mainly base your ...READ MORE

Jul 18, 2019 in Python by Arvind
• 3,040 points
1,279 views
0 votes
1 answer

example of creating a stacked bar plot with error bars using the bar function

Have a look at this: import numpy as ...READ MORE

May 27, 2019 in Python by Kunal
1,279 views
0 votes
1 answer

What's the right way to concatenate files and appending the New Line character in Python? Text or binary mode?

It seems like you're using the wrong ...READ MORE

Nov 13, 2018 in Python by Anirudh
• 2,080 points

edited Dec 14, 2018 by Anirudh 1,274 views
0 votes
0 answers

No acceptable C compiler found in $PATH when installing python

I followed this post to install a ...READ MORE

May 19, 2022 in Python by Kichu
• 19,050 points
1,273 views
0 votes
1 answer

Purpose of "%matplotlib inline"

The %matplotlib inline is nothing but a ...READ MORE

Feb 10, 2022 in Python by Rahul
• 9,670 points
1,273 views
0 votes
1 answer

Raw_Input() Is Not Defined

For Python 3.x, use input(). For Python 2.x, ...READ MORE

Sep 17, 2018 in Python by Priyaj
• 58,090 points
1,272 views
0 votes
2 answers

Finding the index of a character in python string

You can use word.find('o') as well to ...READ MORE

Jun 1, 2018 in Python by george
• 200 points
1,272 views
0 votes
1 answer

how to play audio highlights his text in python?

Hey, You can split the audio files into ...READ MORE

Mar 27, 2020 in Python by Gitika
• 65,910 points
1,271 views
0 votes
1 answer

List comprehension on a nested list - How to do it in Python?

Not sure what your desired output is, ...READ MORE

Nov 21, 2018 in Python by Nymeria
• 3,560 points
1,270 views
0 votes
1 answer

How do I use Django templates without the rest of Django?

Hello @kartik, Let's say you have this important ...READ MORE

Jun 23, 2020 in Python by Niroj
• 82,880 points
1,269 views
+1 vote
1 answer

Creating a range of dates in Python

Yes, you can do it as follows: import ...READ MORE

Jul 4, 2019 in Python by Wajiha
• 1,950 points
1,267 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,266 views
0 votes
1 answer

Can you explain what is the use _init_ and self in python?

Hi, The basic difference between these two are _init_ ...READ MORE

Aug 14, 2019 in Python by anonymous
1,261 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,261 views
0 votes
1 answer

Import a module from a relative path?

Assuming that both your directories are real ...READ MORE

Nov 25, 2020 in Python by Gitika
• 65,910 points
1,260 views
0 votes
1 answer

How to sort a list of strings?

Basic answer: mylist = ["b", "C", "A"] mylist.sort() This modifies ...READ MORE

Jun 4, 2018 in Python by aryya
• 7,450 points
1,260 views
0 votes
1 answer

Python: how to print long text on different lines?

replace with a newline char. file.write(response.read().decode('utf-8').replace(";","\n")) In [72]: ...READ MORE

Sep 5, 2018 in Python by slayer
• 29,350 points
1,256 views
+1 vote
1 answer

How to save graph using matplotlib library?

Hi@akhtar, You can find one function called savefig ...READ MORE

May 21, 2020 in Python by MD
• 95,440 points
1,255 views
0 votes
1 answer

Web scraping data from a Spotfire web report

Hi, @There, You can try this: It reads ...READ MORE

Jun 30, 2020 in Python by Gitika
• 65,910 points
1,253 views
0 votes
1 answer

Force Python Scrapy not to encode URL

When creating a Request object scrapy applies some url ...READ MORE

Jul 24, 2019 in Python by SDeb
• 13,300 points
1,253 views
0 votes
1 answer

How do I convert a Python program to a runnable .exe Windows program?

Understand that every 'freezing' application for Python ...READ MORE

Oct 13, 2018 in Python by SDeb
• 13,300 points
1,251 views
+1 vote
1 answer

How to append an integer to a string?

You can not directly concatenate two different ...READ MORE

Aug 16, 2018 in Python by Omkar
• 69,230 points
1,250 views
0 votes
0 answers

How to install tkinter on windows?

Does it work like the other libraries ...READ MORE

Jul 17, 2019 in Python by Waseem
• 4,540 points
1,249 views
+4 votes
6 answers

Use of "continue" in python

The break statement is used to "break" ...READ MORE

Jul 16, 2018 in Python by Omkar
• 69,230 points
1,248 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,246 views
0 votes
1 answer

How do I use the built in password reset/change views with my own templates?

Hello @kartik, You'll notice that password_reset takes a named parameter ...READ MORE

Aug 13, 2020 in Python by Niroj
• 82,880 points
1,243 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,243 views
0 votes
0 answers

Python Requests get returns response code 401 for nse india website

I use this program to get the ...READ MORE

Apr 22, 2022 in Python by Edureka
• 13,620 points
1,240 views
+1 vote
1 answer

How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

Aug 8, 2018 in Python by Priyaj
• 58,090 points
1,240 views