Trending questions in Python

0 votes
0 answers

I am trying to install PyBase64 on my python 3.8. But I end up with the following error:

$ pip install pybase ERROR: Could not find ...READ MORE

Mar 24, 2020 in Python by Nishant
• 210 points
• 4,598 views
0 votes
1 answer

How Can I log a Python error with debug information?

Hii, Using exc_info options may be better, to allow you ...READ MORE

May 27, 2020 in Python by Niroj
• 82,800 points
• 1,760 views
0 votes
1 answer

How to keep keys/values in same order as declared?

Hello @kartik, Dictionaries will use an order that ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,800 points
• 2,905 views
0 votes
1 answer

TypeError: unsupported operand type(s) for -: 'list' and 'int'

Hey, @William For me the code is working ...READ MORE

Mar 11, 2020 in Python by Roshni
• 10,440 points
• 5,066 views
0 votes
1 answer

How do I log a Python error with debug information?

Hii, In most applications, you won't be calling ...READ MORE

May 11, 2020 in Python by Niroj
• 82,800 points
• 2,407 views
0 votes
0 answers

for label, value in s.iteritems(): s.set_value(label, value+2) s.head()

READ MORE

Jun 6, 2020 in Python by WELL
• 140 points

recategorized Jun 8, 2020 by Gitika • 1,360 views
0 votes
1 answer

Python code to send an email with an attachment

Hi @Vipul, try out this code. I've ...READ MORE

Jun 11, 2019 in Python by Adil
• 16,858 views
+1 vote
1 answer

Want to know how to write paragraph on image using pillow python?

Hi, @Shantanu, You can make use of the ...READ MORE

Apr 14, 2020 in Python by Gitika
• 65,730 points
• 3,517 views
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

Jun 28, 2019 in Python by anonymous
• 16,374 views
0 votes
1 answer

Is it possible in Python requests to print entire HTTP request?

A better idea is to use the ...READ MORE

Nov 26, 2018 in Python by Nymeria
• 3,560 points
• 25,332 views
0 votes
0 answers

How do I fix this Set function in python?

I have the following code below I ...READ MORE

May 20, 2020 in Python by Olufemiodubote
• 120 points
• 2,005 views
0 votes
1 answer

AttributeError: 'module' object has no attribute 'HTTPSConnection'

Hi@akhtar, You have to install openssl and openssl-devel before ...READ MORE

Apr 20, 2020 in Python by MD
• 95,460 points
• 3,223 views
0 votes
1 answer

Error:Installation Issue with matplotlib Python

Hii @kartik, I assume you have installed the ...READ MORE

May 7, 2020 in Python by Niroj
• 82,800 points
• 2,418 views
0 votes
2 answers

Replacements for switch statement in Python?

The recommended path for Python 3.10 which ...READ MORE

Feb 9, 2022 in Python by Soham
• 9,730 points
• 2,214 views
0 votes
1 answer

What is the procedure to update spyder on Anaconda?

This is a pretty simple thing to ...READ MORE

Aug 19, 2019 in Python by Arvind
• 3,050 points
• 13,703 views
0 votes
1 answer

How to unzip a list of tuples into individual lists?

Hello @kartik, zip is its own inverse! Provided you ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,800 points
• 2,988 views
0 votes
1 answer

How to check whether a pandas DataFrame is empty?

Hello @kartik, I use the len function. It's much faster ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,800 points
• 2,963 views
0 votes
1 answer

I am trying to install visualize on my python 3.8 but i end up with the followinf error.

Hi@Avinash, I think the module name is visualization ...READ MORE

Apr 27, 2020 in Python by MD
• 95,460 points
• 2,849 views
0 votes
1 answer

Difference between pop and delete methods

Using delete leaves undefined holes in the ...READ MORE

Jan 18, 2022 in Python by saurabh thapa

edited Mar 5, 2025 • 3,626 views
+1 vote
0 answers

TypeError: only integer scalar arrays can be converted to a scalar index

import cv2 import numpy as np import matplotlib.pyplot as ...READ MORE

Dec 18, 2019 in Python by sandeep
• 130 points
• 8,413 views
0 votes
1 answer

web scraping using python

Hey, @Pythonist, You can try this, ##################################### Method 1 import ...READ MORE

May 6, 2020 in Python by Gitika
• 65,730 points
• 2,373 views
0 votes
0 answers

I am trying to build a pong game this is what they showed me.

import turtle wn = turtle.Screen() wn.bgcolor("blue") wn.tracer(0) #Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) paddle_a.shape("square") paddle_a.color("red") paddle_a.ShapeSize paddle_a.penup() paddle_a.goto(-350, ...READ MORE

May 23, 2020 in Python by Praise
• 120 points

edited May 25, 2020 by Gitika • 1,668 views
0 votes
1 answer

How can we remove an element from dic type variables. Eg : a={'A' : 2 , 'K' : 4 , 'D' : 6} }

Hey, @Kanishka, Suppose your dict contains: a={'A' : 2 ...READ MORE

May 20, 2020 in Python by Gitika
• 65,730 points
• 1,658 views
0 votes
1 answer

Building Time Series Model - Getting error involving datetime

Hey sharonda, Use a python datetime or string  results.get_prediction(start='2020-04-08', ...READ MORE

Apr 8, 2020 in Python by Niroj
• 82,800 points
• 3,362 views
0 votes
1 answer

How to clone or copy a list?

Hello @kartik, With new_list = my_list, you don't actually ...READ MORE

May 15, 2020 in Python by Niroj
• 82,800 points
• 1,779 views
0 votes
1 answer

Create an empty list in python with certain size

Try this instead: lst = [None] * 10 The ...READ MORE

Aug 2, 2018 in Python by bug_seeker
• 15,520 points
• 29,912 views
+1 vote
4 answers

How to write nested dictionaries to a CSV file

Using DictWriter there is no need in ...READ MORE

Oct 18, 2018 in Python by Richard William
• 30,411 views
0 votes
1 answer

How to configure smtp server using python?

Hi@akhtar, To set smtp server in your system, ...READ MORE

Apr 15, 2020 in Python by MD
• 95,460 points
• 2,947 views
0 votes
1 answer

How can I find script's directory with Python?

Hii, You need to call os.path.realpath on __file__, so that when __file__ is ...READ MORE

May 11, 2020 in Python by Niroj
• 82,800 points
• 1,810 views
+1 vote
1 answer

Python BeautifulSoup check if find returns Null object

You can add an if condition to ...READ MORE

May 9, 2019 in Python by Ruby
• 17,648 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,800 points
• 2,309 views
0 votes
1 answer

How to create new environment using conda?

Hi@akhtar, Environment means you are creating your own ...READ MORE

Apr 21, 2020 in Python by MD
• 95,460 points
• 2,595 views
0 votes
1 answer

How do I find current module name in python?

A module can find out its own ...READ MORE

Jul 30, 2019 in Python by Simran
• 14,112 views
0 votes
1 answer

Compress and decompress string in Python

You can use the zlib module available in ...READ MORE

Jul 23, 2019 in Python by Bhagavath

edited Oct 7, 2021 by Sarfaraz • 14,357 views
0 votes
1 answer

Python error "SyntaxError: invalid syntax"

but i m getting this ouput: Enter the ...READ MORE

Mar 20, 2020 in Python by anonymous
• 9,531 views
0 votes
1 answer

DatabaseError: current transaction is aborted, commands ignored until end of transaction block?

Hello @kartik, To get rid of the error, roll ...READ MORE

May 6, 2020 in Python by Niroj
• 82,800 points
• 1,899 views
0 votes
0 answers

name error: name 'symtr' is not globally defined

class Solution(object):     def symtr(self,root1, root2):         if(root1==None and root2==None):             return True         elif(root1==None ...READ MORE

May 14, 2020 in Python by anonymous
• 120 points
• 1,599 views
0 votes
1 answer

How to remove a key from a Python dictionary?

Hello, If you need to remove a lot ...READ MORE

Apr 15, 2020 in Python by Niroj
• 82,800 points
• 2,806 views
0 votes
1 answer

How to create a zip archive of a directory in Python?

Hello @kartik, The easiest way is to use shutil.make_archive. ...READ MORE

May 11, 2020 in Python by Niroj
• 82,800 points
• 1,640 views
0 votes
1 answer

Python function to find a list of all keywords

You can use the keyword module for ...READ MORE

Jun 17, 2019 in Python by Ayman
• 15,751 views
0 votes
0 answers

Find all the classes of the table tags

Create a nested list containing classes of ...READ MORE

Apr 24, 2020 in Python by Abhishek
• 120 points
• 2,331 views
0 votes
1 answer

ImportError: No module named toolkit.interface

I think you didn't set your python ...READ MORE

Apr 22, 2020 in Python by MD
• 95,460 points
• 2,312 views
+1 vote
1 answer

Python script to compare 2 files

Refer the given code and let us ...READ MORE

Jul 31, 2019 in Python by Arpit
• 13,745 views
0 votes
1 answer

Convert string to unicode in Python

Suppose you have a string in ASCII form ...READ MORE

Jul 23, 2019 in Python by Gani
• 14,104 views
0 votes
2 answers

How to solve the error - ssl module not found?

Hey, @There, nstall the necessary packages for Python ...READ MORE

Oct 23, 2020 in Python by Gitika
• 65,730 points
• 3,717 views
0 votes
1 answer

How to connect mail server with smtplib module in python?

Hi@akhtar, You can connect mail server using smtplib ...READ MORE

Apr 15, 2020 in Python by MD
• 95,460 points
• 2,453 views
0 votes
1 answer

How to make a chain of function decorators?

Hello @kartik, Python decorators add extra functionality to ...READ MORE

Apr 13, 2020 in Python by Niroj
• 82,800 points
• 2,471 views
0 votes
0 answers

How to iterate through an S3 bucket to find the last modified file (and then save that to a local folder)

Hi there guys, I've been tasked with ...READ MORE

Feb 18, 2020 in Python by Markus
• 120 points
• 4,869 views
0 votes
0 answers

Python error " TypeError: string indices must be integers "

I am trying to execute following code ...READ MORE

Apr 3, 2020 in Python by Falguni
• 140 points

edited Apr 5, 2020 by Falguni • 2,883 views
0 votes
1 answer

Python: Megre multiple dataframes into single data frame

You can merge the data frame using ...READ MORE

Jul 14, 2019 in Python by Sharan
• 14,278 views