Trending questions in Python

+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

Jul 25, 2018 in Python by Abhi
• 3,720 points
798 views
0 votes
1 answer

How to add to the python path in Windows?

You know what has worked for me ...READ MORE

Jul 25, 2018 in Python by Frankie
• 9,830 points
830 views
0 votes
1 answer

Python: list of lists

Lists are a mutable type - in ...READ MORE

Aug 2, 2018 in Python by bug_seeker
• 15,520 points
470 views
0 votes
1 answer

How to import other Python files?

importlib is recent addition in Python to ...READ MORE

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

What is the Python equivalent for a case/switch statement?

if x == 'a':  # Do the ...READ MORE

Jul 26, 2018 in Python by Priyaj
• 58,090 points
757 views
+1 vote
1 answer

How to replace id with attribute corresponding to id of another table?

Use the following query statement and let ...READ MORE

Aug 8, 2018 in Python by Priyaj
• 58,090 points
2,076 views
0 votes
1 answer

How do I sort a dictionary by value?

It is not possible to sort a ...READ MORE

Jul 30, 2018 in Python by Priyaj
• 58,090 points
556 views
+1 vote
4 answers

How can I concatenate str and int objects?

If you want to concatenate int or ...READ MORE

Oct 18, 2018 in Python by subhm
941 views
+4 votes
3 answers

What does these operator mean **, ^, %, // ?

** - Performs exponential (power) calculation on ...READ MORE

Apr 12, 2018 in Python by anto.trigg4
• 3,440 points
1,073 views
0 votes
1 answer

Understanding the map function

map isn't particularly pythonic. I would recommend ...READ MORE

Jul 31, 2018 in Python by Priyaj
• 58,090 points
475 views
0 votes
2 answers

Splitting a Python String

The split() method in Python returns a ...READ MORE

Oct 3, 2018 in Python by anonymous
496 views
0 votes
1 answer

How to use “raise” keyword in Python

You can use it to raise errors ...READ MORE

Jul 30, 2018 in Python by Priyaj
• 58,090 points
512 views
+1 vote
2 answers

How to resize the image canvas to maintain a square aspect ratio

down voteacceptedUsing OpenCVYou can use resize() in OpenCV to ...READ MORE

Apr 4, 2018 in Python by charlie_brown
• 7,720 points

edited Jul 11, 2023 by Khan Sarfaraz 1,293 views
0 votes
1 answer

How to sort a list of strings?

Try  items = ["live", "like", "code", "cool", "bug"] ...READ MORE

Jul 27, 2018 in Python by Priyaj
• 58,090 points
579 views
+1 vote
1 answer

Appending data to a file [closed]

To append a file without overwriting, open ...READ MORE

Aug 7, 2018 in Python by Omkar
• 69,210 points

edited Aug 7, 2018 by Omkar 430 views
+2 votes
2 answers

In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

Apr 10, 2018 in Python by charlie_brown
• 7,720 points
1,100 views
0 votes
1 answer

Python - convert string to list

try states.split() this would help. READ MORE

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

Difference between pop and delete methods

I think you mean del() and not ...READ MORE

Jun 25, 2018 in Python by Hamartia's Mask
• 1,580 points
1,838 views
0 votes
1 answer

How to get the current time in Python

>>> import datetime >>> datetime.datetime.now() datetime(2018, 25, ...READ MORE

Jul 25, 2018 in Python by Frankie
• 9,830 points
533 views
0 votes
1 answer

How do you append to a file?

with open("test.txt", "a") as myfile: myfile.write("appended text ...READ MORE

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

__all__ in python

That is the list of public objects ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
703 views
0 votes
1 answer

How to properly ignore Exceptions?

try:  doSomething() except:  pass or try:  doSomething() except Exception: ...READ MORE

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

Python - convert string to list

states.split() will return ['Alaska', 'Alabama', 'Arkansas', 'American', 'Samoa', ...READ MORE

Jul 25, 2018 in Python by Frankie
• 9,830 points
476 views
0 votes
1 answer

Best way to create a simple python web service

web.py is probably the simplest web framework ...READ MORE

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

Python Null Object

Use the 'None' keyword to denote the ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
681 views
+1 vote
2 answers

View onto a numpy array?

 just index it as you normally would. ...READ MORE

Oct 18, 2018 in Python by roberto
698 views
0 votes
1 answer

*args and **kwargs in python

In cases when we don’t know how ...READ MORE

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

What is the output of and explanation?

It will print concatenated lists. Output would ...READ MORE

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

Mean and average in numpy

np.average() can be used to calculate weighted ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
579 views
0 votes
1 answer

Connect to a MySQL DB in python?

db = MySQLdb.connect(host="localhost", # ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
562 views
0 votes
1 answer

Monkey Patching

Dynamically modifying a class or module at ...READ MORE

Jul 20, 2018 in Python by Priyaj
• 58,090 points
553 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
990 views
0 votes
1 answer

Deleting a list element by index

Use the del() function del a[2] Or you can ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
499 views
0 votes
1 answer

What are the key features of Python?

If it makes for an introductory language ...READ MORE

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

Accessing Environment variables

import os print(os.environ['HOME']) READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
413 views
0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

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

init.py file

It is used to denote directories on ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
396 views
0 votes
1 answer

Appending data to a file [closed]

with open("test.txt", "a") as myfile: ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
387 views
0 votes
1 answer

Random selections from list

Use random.choice() foo = ['a', 'b', 'c', 'd', ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
382 views
+2 votes
2 answers

How to use BeatifulSoup for webscraping?

your programme is fine until you start ...READ MORE

Apr 4, 2018 in Python by charlie_brown
• 7,720 points
760 views
0 votes
0 answers

Storing a list of arrays into a CSV file and retrieving it back in a different program

This is the code that I am ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
2,172 views
0 votes
1 answer

Combining numpy arrays

There is concatenation function for numpy arrays ...READ MORE

Jul 3, 2018 in Python by Hamartia's Mask
• 1,580 points
934 views
0 votes
1 answer

Difference between two lists in python

difference = list(set(list1) - set(list2)) READ MORE

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

Lists and Tuples

Lists are mutable homogeneous sequences whereas tuples ...READ MORE

Jul 17, 2018 in Python by Mrunal
• 680 points
487 views
0 votes
1 answer

Append & Extend

Hi. This question has already been answered. Take ...READ MORE

Jul 2, 2018 in Python by Nietzsche's daemon
• 4,260 points
746 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
3,995 views
0 votes
1 answer

Numpy data in csv

Use this -  numpy.savetxt("data.csv", arr, delimiter=",") READ MORE

Jul 3, 2018 in Python by Hamartia's Mask
• 1,580 points
585 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,103 views
0 votes
0 answers

Cannot make connection to .accdb file using python

I am writing a script that needs ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
1,654 views
+1 vote
1 answer

How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

Aug 8, 2018 in Python by Priyaj
• 58,090 points
1,229 views