Trending questions in Python

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,840 points
1,356 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,840 points
2,116 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,840 points
2,111 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,770 points
2,451 views
0 votes
2 answers

Removing Title bar in Tkinter program

you can remove the title bar by ...READ MORE

Mar 19, 2019 in Python by anonymous
21,162 views
0 votes
1 answer

Boto3 S3, sort bucket by last modified

I tried the following method. Its not 100% ...READ MORE

Jun 4, 2019 in Python by SDeb
• 13,300 points
16,080 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,770 points
1,493 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
7,512 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,770 points
854 views
0 votes
1 answer

i write this python to read dataset into panda data frame but im getting NameError: name 'true' is not defined. Below is the code:

change  def parse(path):   g = gz ...READ MORE

Mar 15, 2020 in Python by Abhishek Shingadiya
4,084 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,710 points
1,138 views
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
3,256 views
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

Apr 7, 2020 in Python by Gitika
• 65,770 points
2,584 views
+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

Oct 18, 2018 in Python by Nabarupa
29,543 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
1,741 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,840 points
932 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,840 points
1,582 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
15,519 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,480 points
3,686 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
941 views
+1 vote
3 answers

How to run the Python program forever?

you can also do the old fashioned ...READ MORE

Jun 10, 2019 in Python by brianno
22,258 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,840 points
887 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 2,347 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,840 points
1,100 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
12,368 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
1,996 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
1,623 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,840 points
733 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,840 points
1,862 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
8,467 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
1,437 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 13,271 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,277 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,840 points
2,020 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
1,414 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
16,404 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
23,523 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
1,645 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,116 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
13,065 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,510 points
28,358 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,840 points
1,524 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
14,330 views
0 votes
0 answers

Numerical_vision_problem [distance_Pixels]

hello everybody, hoping that all with good ...READ MORE

May 2, 2020 in Python by anonymous
• 120 points
733 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
12,555 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,770 points
2,612 views
0 votes
1 answer

How to convert a dataframe into list?

Hi@akhtar, You can convert your dataframe into list. ...READ MORE

Apr 25, 2020 in Python by MD
• 95,460 points
948 views
0 votes
1 answer

How do I sort a list of dictionaries by a value of the dictionary?

Hello @kartik, import operator To sort the list of ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,840 points
876 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
12,417 views
0 votes
1 answer

How do I parse a string to a float or int?

Hii, Python method to check if a string ...READ MORE

Apr 13, 2020 in Python by Niroj
• 82,840 points
1,235 views