Trending questions in Python

0 votes
1 answer

Is it possible to find the source code of built-in functions of Python?

Since Python is open source you can ...READ MORE

Jul 17, 2019 in Python by Neel
• 3,020 points
4,432 views
0 votes
1 answer

How do I make one turtle follow another turtle in python?

Try something like this: from turtle import Turtle, ...READ MORE

Jul 8, 2019 in Python by Ayushi
4,771 views
0 votes
1 answer

How to write a regular expression to check whether an input is an identifier or not?

As per the documentation, an identifer can ...READ MORE

Aug 8, 2019 in Python by Neel
• 3,020 points
3,432 views
0 votes
1 answer

How to suppress console output in Python?

You can try the following block of ...READ MORE

Jun 7, 2019 in Python by SDeb
• 13,300 points
5,924 views
0 votes
1 answer

'NodeList' object has no attribute 'firstChild'

Use the following piece of code: from xml.dom ...READ MORE

Jul 22, 2019 in Python by Wajiha
• 1,950 points
3,961 views
+1 vote
2 answers

Python convert extracted excel file to csv

Some services require table data in CSV ...READ MORE

Aug 30, 2019 in Python by Mian Tanzeel
6,569 views
0 votes
1 answer

Install virtualenv - python

Follow these steps to install virtualenv on ...READ MORE

Oct 7, 2019 in Python by Harshit
591 views
0 votes
1 answer

How to find the greatest number in a list in Python?

1. By using max function -  highest = ...READ MORE

Aug 21, 2019 in Python by Neel
• 3,020 points
2,612 views
0 votes
1 answer

How do I check if input string is a valid regular expression or not in Python?

Hi. Good question! Well, just like what ...READ MORE

Feb 12, 2019 in Python by Nymeria
• 3,560 points
10,815 views
0 votes
1 answer

Can I build a plagiarism checker using python?

Hey @Alessha, you can use an SDK ...READ MORE

Aug 5, 2019 in Python by Kalgi
• 52,360 points
3,270 views
0 votes
1 answer

Python error "ValueError: size needs to be (int width, int height)" while using pygame.Surface

pygame.Surface takes in integer values for building ...READ MORE

Jun 19, 2019 in Python by Varsha
5,267 views
0 votes
1 answer

how to check the syntax of python program without running the program?

Yes, it is possible to check the ...READ MORE

Jun 27, 2019 in Python by Arvind
• 3,040 points
4,917 views
0 votes
1 answer

Installing package not found in conda

You can install pip in your conda env and then run pip ...READ MORE

Jul 31, 2019 in Python by SDeb
• 13,300 points
3,428 views
0 votes
1 answer

Execute PHP code in Python

Try the following Code: import subprocess # if the ...READ MORE

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

How to import json file to mongodb using pyspark (or python)?

You can use the same format as ...READ MORE

Sep 9, 2019 in Python by Karan
1,694 views
0 votes
1 answer

better way to drop nan rows in pandas

Use dropna: dat.dropna() You can pass param how to drop if all ...READ MORE

Jul 9, 2019 in Python by SDeb
• 13,300 points
4,330 views
0 votes
2 answers

Manually raising (throwing) an exception in Python

Exception handling issues in python can easily ...READ MORE

Jan 18, 2019 in Python by nick
• 140 points
17,144 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'onkeypress'"

Instead of  wn.onkeypress(go_up, "w") Try wn.onkey(go_uo, " ...READ MORE

Jul 5, 2019 in Python by Pooja
4,458 views
0 votes
1 answer

How to pass query string in url using python requests?

You can pass the key-value pairs to ...READ MORE

May 14, 2019 in Python by Likith
6,643 views
0 votes
1 answer

How to fill Null/NaN values in Pandas Dataframe?

Pandas allows you to change all the ...READ MORE

May 13, 2019 in Python by Rajat
6,620 views
0 votes
1 answer

Create an empty tkinter window - Python

Its pretty simple: # import the module import Tkinter $Create ...READ MORE

Jul 22, 2019 in Python by Aysha
3,553 views
0 votes
1 answer

Difference between a normal def defined function and lambda function in python?

Have a look at this code: # Python ...READ MORE

May 20, 2019 in Python by Trisha
6,261 views
0 votes
1 answer

How can I change the iteration variable inside a for loop in python?

Assume you have a list of lists: my_list ...READ MORE

Jun 10, 2019 in Python by Shubham Bansal
5,312 views
0 votes
1 answer

How to remove all characters before a specific character in Python?

Use re.sub. Just match all the chars ...READ MORE

Feb 27, 2019 in Python by SDeb
• 13,300 points
9,765 views
0 votes
1 answer

How to convert pandas dataframe to numpy array?

Irrespective of whether the dataframe has similar ...READ MORE

May 13, 2019 in Python by Rishi
6,523 views
0 votes
1 answer

Python Pandas: Find length of string in dataframe

You can find the length of the ...READ MORE

May 14, 2019 in Python by Firoz
6,410 views
0 votes
1 answer

Performing divison on timedelta object in python?

Refer the following piece of code: e1=datetime.timedelta(days=32, seconds=0, ...READ MORE

Aug 13, 2019 in Python by Wajiha
• 1,950 points
2,447 views
0 votes
1 answer

What are first class objects in Python?

First-class objects in a language are handled uniformly ...READ MORE

Aug 2, 2019 in Python by Arvind
• 3,040 points
2,883 views
0 votes
1 answer

How do I use urllib to see if a website is 404 or 200 in Python?

For Python 3, try doing this: import urllib.request, ...READ MORE

Nov 29, 2018 in Python by Nymeria
• 3,560 points

edited Dec 11, 2018 by Nymeria 13,434 views
+2 votes
1 answer

Import zip files and process the excel files ( inside the zip files ) by using pyspark connecting with pymongo

I found this sample code: import zipfile import io def ...READ MORE

Aug 19, 2019 in Python by Reshma
2,150 views
0 votes
1 answer

How I do get the data from the <font> tag from a given tr tag?

This should work: from bs4 import BeautifulSoup html_doc='''<tr id="tr_m_1570:240HJY" ...READ MORE

Sep 18, 2019 in Python by Omkar
• 69,230 points
724 views
0 votes
1 answer

PyCharm type hinting weirdness

This looks like a bug in PyCharm. ...READ MORE

Jul 22, 2019 in Python by SDeb
• 13,300 points
3,199 views
0 votes
1 answer

Make turtle face a particular direction in python

You can use the the setheading command turtle.setheading(<degrees/radians>) In ...READ MORE

Jul 8, 2019 in Python by Jinu
3,790 views
0 votes
1 answer

What does AF_INET mean?

AF_INET refers to Address from the Internet ...READ MORE

Jul 3, 2019 in Python by Wajiha
• 1,950 points
3,975 views
0 votes
1 answer

What is the purpose of else part in python exception handling?

When an error occurs, or exception as ...READ MORE

Aug 23, 2019 in Python by Arvind
• 3,040 points
1,791 views
0 votes
1 answer

How to get value in Pandas dataframe using index?

You can use the iloc method to do ...READ MORE

Apr 8, 2019 in Python by Rohit
7,668 views
0 votes
1 answer

Python: Both list gets affected after creating list using list2 = list1

When you are copying a list to ...READ MORE

Aug 1, 2019 in Python by Lohit
2,691 views
0 votes
1 answer

How to open gmail and other menus from Google Apps menu using python selenium

You have to add implicit wait until ...READ MORE

Jul 31, 2019 in Python by Rishi
2,704 views
+1 vote
0 answers
0 votes
1 answer

how to find files and skip directories in os.listdir

You need to filter out directories; os.listdir() ...READ MORE

Mar 6, 2019 in Python by SDeb
• 13,300 points
9,030 views
0 votes
1 answer

How to read numbers from file in Python?

Assuming you don't have extraneous whitespace: with open('file') ...READ MORE

Apr 16, 2019 in Python by SDeb
• 13,300 points
7,252 views
0 votes
1 answer

How to get score of prediction from random forest?

Well, there's a built-in method for this ...READ MORE

Sep 10, 2019 in Python by Arvind
• 3,040 points
924 views
0 votes
1 answer

Get bbox in data coordinates in matplotlib

I'm not sure how you got the ...READ MORE

Jun 18, 2019 in Python by SDeb
• 13,300 points
4,509 views
0 votes
0 answers

Converting a csv file into html file using pandas file.to_html command in pycharm?

Hello guys, I am having some problems ...READ MORE

Aug 24, 2019 in Python by anonymous
1,654 views
0 votes
2 answers

How to implement Stack in python

There are different method to implement stack ...READ MORE

Jun 21, 2020 in Python by pagarsach
• 160 points
1,133 views
0 votes
1 answer

Writing output to new file using xml.etree.ElementTree in python

To write results to a new file, ...READ MORE

Jul 25, 2019 in Python by Wajiha
• 1,950 points
2,913 views
0 votes
1 answer

what is a constructor in python?

Constructors are for instantiating an object.The task ...READ MORE

Apr 1, 2019 in Python by Tushar
• 200 points
7,912 views
0 votes
1 answer

What is the easiest way to concatenate two lists in Python?

You can use the + operator to combine them: list1 ...READ MORE

Sep 16, 2019 in Python by Neel
• 3,020 points
654 views
+1 vote
1 answer

I wanted to change the entire row where index is 9 how can i do that

Import the file as a pandas dataframe ...READ MORE

Sep 16, 2019 in Python by Rishi
515 views
+1 vote
1 answer

How to handle Real-Time Matplotlib Plotting

To draw a continuous set of random ...READ MORE

Sep 26, 2018 in Python by Priyaj
• 58,090 points
15,839 views