Most voted questions in Python

0 votes
1 answer

What is the difference between list and tuple?

Lists are mutable(values can be changed) whereas ...READ MORE

May 5, 2018 in Python by aayushi
• 750 points
6,565 views
0 votes
1 answer

Raw_input method is not working in python3. How to use it?

raw_input is not supported anymore in python3. ...READ MORE

May 5, 2018 in Python by aayushi
• 750 points
3,110 views
0 votes
1 answer

Padding a string

>>> s = '1123' >>> print s.zfill(8) #desired ...READ MORE

May 4, 2018 in Python by Nietzsche's daemon
• 4,260 points
442 views
0 votes
1 answer

Removing surrounding whitespace

Try the strip() function:  s = s.strip() If you ...READ MORE

May 4, 2018 in Python by Nietzsche's daemon
• 4,260 points
592 views
0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

Apr 2, 2019 in Python by anonymous
5,407 views
0 votes
1 answer

how to find factorial of a number?

You can find factorial by many ways. ...READ MORE

May 4, 2018 in Python by aayushi
• 750 points
1,471 views
0 votes
1 answer

Count the frequency of all list items

You can do this using a dictionary: dict((i, ...READ MORE

May 3, 2018 in Python by Nietzsche's daemon
• 4,260 points
561 views
0 votes
1 answer

Renaming columns of dataframes

Assign the new names to the column ...READ MORE

May 3, 2018 in Python by Nietzsche's daemon
• 4,260 points
382 views
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

May 2, 2018 in Python by aayushi
• 750 points
956 views
0 votes
1 answer

How to add a new line in Python?

You can use '\n' for a next ...READ MORE

May 2, 2018 in Python by aayushi
• 750 points
1,031 views
0 votes
1 answer

Create time lag in Python

import time time.sleep(10) READ MORE

May 2, 2018 in Python by Nietzsche's daemon
• 4,260 points
1,584 views
0 votes
1 answer

Deleting a dictionary entry in Python

Use pop(): mapping.pop("key_x") #key_x is a key entry Note ...READ MORE

May 2, 2018 in Python by Nietzsche's daemon
• 4,260 points
550 views
0 votes
1 answer

Unable to take input from user in Python

num = input("enter number") print(num) READ MORE

May 1, 2018 in Python by aayushi
• 750 points
608 views
0 votes
1 answer

Install pip in Python 3.4

Don't worry! Python already comes in default ...READ MORE

May 1, 2018 in Python by aayushi
• 750 points
3,033 views
0 votes
1 answer

Copying lists in python

Assigning one list to another one simply ...READ MORE

Apr 30, 2018 in Python by Nietzsche's daemon
• 4,260 points
456 views
0 votes
1 answer

List of lines from a file

with open(fname) as f: ...READ MORE

Apr 30, 2018 in Python by Nietzsche's daemon
• 4,260 points
364 views
0 votes
1 answer

Run Unix command within Python

From the python docs, use the subprocess ...READ MORE

Apr 27, 2018 in Python by Nietzsche's daemon
• 4,260 points
495 views
0 votes
1 answer

Merge two dicts

dict3 = dict1.copy() # merges ...READ MORE

Apr 27, 2018 in Python by Nietzsche's daemon
• 4,260 points
601 views
0 votes
2 answers

What is the use of Python language?

python is general purpose programming language.it very ...READ MORE

Mar 15, 2019 in Python by rajesh kumar
741 views
0 votes
1 answer

Parse JSON in Python

import json data=json.loads(employee_data) print(data) READ MORE

Apr 26, 2018 in Python by aayushi
• 750 points
1,023 views
0 votes
1 answer

Returning values in python

Place your values in a tuple and ...READ MORE

Apr 26, 2018 in Python by Nietzsche's daemon
• 4,260 points
326 views
0 votes
1 answer

Variables in Python

Variables in python work differently than they ...READ MORE

Apr 26, 2018 in Python by Nietzsche's daemon
• 4,260 points
479 views
0 votes
1 answer

Iterating over multiple lists

import itertools for item in itertools.chain(listone, listtwo): #li ...READ MORE

Apr 25, 2018 in Python by Nietzsche's daemon
• 4,260 points
1,125 views
0 votes
1 answer

Slice notation in Python for string reversal

The slice notation is [start:end:step]. Step = ...READ MORE

Apr 25, 2018 in Python by Nietzsche's daemon
• 4,260 points
490 views
0 votes
1 answer

Get index in for loop

Use enumerate(): for index, value in enumerate(array): ...READ MORE

Apr 24, 2018 in Python by Nietzsche's daemon
• 4,260 points
360 views
0 votes
1 answer

Checking for empty list

Empty objects in python by default have ...READ MORE

Apr 24, 2018 in Python by Nietzsche's daemon
• 4,260 points
401 views
0 votes
1 answer

How to slice an array using python numpy? Is there any numpy tutorial which has covered all its operations?

Slicing is basically extracting particular set of ...READ MORE

Apr 24, 2018 in Python by Christine
• 15,790 points
1,004 views
0 votes
1 answer

how to download and install Django rest framework?

To install Django, you can simply open ...READ MORE

Apr 24, 2018 in Python by Christine
• 15,790 points
1,624 views
0 votes
1 answer

Deleting list elements

Use pop(): a = [1, 2, 3, 4] a.pop(2) print(a) Now ...READ MORE

Apr 23, 2018 in Python by Nietzsche's daemon
• 4,260 points
353 views
0 votes
1 answer

Adding elements to a list in python

Use extend() instead: l = [5, 7, 12, ...READ MORE

Apr 23, 2018 in Python by Nietzsche's daemon
• 4,260 points
544 views
0 votes
1 answer

How to perform web scraping with python?

Hey, there are various libraries used in ...READ MORE

Apr 20, 2018 in Python by aayushi
• 750 points
1,593 views
0 votes
1 answer

Dimension in python numpy

Use the .shape to print the dimensions ...READ MORE

Apr 20, 2018 in Python by aayushi
• 750 points
548 views
0 votes
1 answer

Where can I get the list of Python keywords?

Just import a module “keyword”. Here you ...READ MORE

Apr 20, 2018 in Python by aayushi
• 750 points
527 views
0 votes
1 answer

Python Switch construct?

You can use the python dictionary for ...READ MORE

Apr 19, 2018 in Python by Nietzsche's daemon
• 4,260 points
477 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

Nov 27, 2018 in Python by Rupali
29,326 views
0 votes
1 answer

Write dates as datetime objects

from datetime import datetime datetime_object = datetime.strptime('Aug 23 ...READ MORE

Apr 18, 2018 in Python by Nietzsche's daemon
• 4,260 points
455 views
0 votes
1 answer

Number division in python

For Python 3, use the // operator: q = ...READ MORE

Apr 18, 2018 in Python by Nietzsche's daemon
• 4,260 points
466 views
0 votes
3 answers

What is python? Where it is used?

 Python is develop by Guido Van Rossum ...READ MORE

Mar 18, 2019 in Python by rajesh kumar
761 views
0 votes
3 answers

Python Selenium best tutorials for beginners

Hope this will help you...Python Tutorial READ MORE

Feb 11, 2019 in Python by aldrinjohn
• 140 points
3,541 views
0 votes
1 answer

what are "and" and "or" operators in Python?

AND - True if both the operands ...READ MORE

Apr 18, 2018 in Python by Johnathon
• 9,090 points
668 views
0 votes
2 answers

how to print the current time using python?

print(datetime.datetime.today()) READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
706 views
0 votes
2 answers

multi line comment

‘’’ This is the way to Enter multi ...READ MORE

Jul 16, 2018 in Python by Priyaj
• 58,090 points
419 views
0 votes
1 answer

What's the difference in Qt between setVisible, setShown and show/hide

show() is just a convenience function for ...READ MORE

Apr 17, 2018 in Python by anonymous
7,501 views
0 votes
1 answer

How to hide a window in the constructor immediately after creation?

You can use QtCore.QTimer class Example(QWidget):     def __init__(self, app):         QWidget.__init__(self)         QTimer.singleShot(0, ...READ MORE

Apr 17, 2018 in Python by anonymous
601 views
0 votes
1 answer

Python class inherits an object

Python 3.x: class MyClass(object): = new-style class class MyClass: ...READ MORE

Apr 17, 2018 in Python by anonymous
1,625 views
0 votes
1 answer

How can I iterate through two lists in Parallel

You have to use the zip function ...READ MORE

Apr 17, 2018 in Python by anonymous
1,225 views
0 votes
1 answer

TkInter Grid Overlapping Issue

Tkinter is fairly efficient. And for the ...READ MORE

Apr 17, 2018 in Python by anonymous
4,013 views
0 votes
1 answer

How can I reformat value_counts() analysis in Pandas for large number of columns?

If I were you, I'd do it ...READ MORE

Apr 17, 2018 in Python by anonymous
6,473 views
0 votes
1 answer

Need help with searching a binary search tree

Instead of multiplying the number of nodes ...READ MORE

Apr 17, 2018 in Python by anonymous
604 views
0 votes
1 answer

Need help writing a dataframe into a csv with the help of a loop

Using the following logic you can arrive ...READ MORE

Apr 17, 2018 in Python by anonymous
3,107 views