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,576 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,121 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
452 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
596 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,419 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,478 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
571 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
386 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
965 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,035 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,588 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
564 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
612 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,044 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
465 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
371 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
503 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
610 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
773 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,026 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
333 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
485 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,138 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
495 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
367 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
410 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,012 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,632 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
366 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
559 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
555 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
535 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
491 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,336 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
468 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
469 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
772 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,550 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
678 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
721 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
428 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,516 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
618 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,638 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,230 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,018 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,489 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
613 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,119 views