Most voted questions in Python

0 votes
1 answer

Is it possible to run a function in Python using the command line?

Suppose your file name is demo.py and ...READ MORE

Jun 26, 2019 in Python by Neel
• 3,020 points
737 views
0 votes
1 answer

How to resolve the typeerror in python os module?

TypeError - because the argument doesn't have ...READ MORE

Jul 31, 2019 in Python by Mohammad
• 3,230 points
1,408 views
0 votes
1 answer

What is the patterns package in python used for?

Pattern is a web mining tool in ...READ MORE

Jul 31, 2019 in Python by Mohammad
• 3,230 points
547 views
0 votes
1 answer

what are sockets?

Sockets are basically open and close gateways ...READ MORE

Jun 25, 2019 in Python by Fata
• 1,050 points
438 views
0 votes
1 answer

'f' strings in Python

They are also known as Literal String ...READ MORE

Jun 25, 2019 in Python by Fata
• 1,050 points
549 views
0 votes
1 answer

Where should virtualenvs go in production?

Arguments for grouping in a common folder Cleaner ...READ MORE

Jun 25, 2019 in Python by SDeb
• 13,300 points
1,966 views
0 votes
1 answer

Pass --no-deps in PIP requirements.txt

There is no such option yet for ...READ MORE

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

How to call Python script from bash with an agrument?

Hi, You need to call the same command ...READ MORE

Jun 25, 2019 in Python by Shabnam
• 930 points
11,534 views
0 votes
1 answer

How can I combine two dataframes in Python Pandas?

Hi, You can use the following methods to ...READ MORE

Jun 25, 2019 in Python by Shabnam
• 930 points
1,049 views
0 votes
1 answer

Attach volume to existing ec2 instance using python

Yes of course that's possible with just ...READ MORE

Jun 24, 2019 in Python by Krina
1,352 views
0 votes
1 answer

Create ESB Volume using python

You only have to use two simple ...READ MORE

Jun 24, 2019 in Python by Greg
437 views
0 votes
1 answer

Create an ec2 instance using boto

Hi @Neel, try this script: reservations = conn.get_all_instances(instance_ids=[sys.argv[1]]) instances ...READ MORE

Jun 24, 2019 in Python by Varsha
629 views
0 votes
1 answer

SSH into an ec2 instance using boto

Hi @Neha, try something like thus: import boto3 import ...READ MORE

Jun 24, 2019 in Python by Varsha
3,455 views
0 votes
1 answer

Deleting elements from numpy array

Use the following code: import numpy as np a=np.array([1,2,3,4]) b=np.delete(a,2) OUTPUT: array([1, ...READ MORE

Jun 24, 2019 in Python by Fata
• 1,050 points

edited Jun 25, 2019 by Kalgi 580 views
0 votes
1 answer

Error while installing cv2 module in pycharm

Go to tools -> python console -> ...READ MORE

Jun 24, 2019 in Python by Quin
10,953 views
0 votes
0 answers

What are different libraries for SOAP in python?

Is the documentation present for those libraries? READ MORE

Jun 24, 2019 in Python by Waseem
• 4,540 points
331 views
0 votes
0 answers

How do you install Tkinter in python?

What is the basic function of Tkinter ...READ MORE

Jun 24, 2019 in Python by Waseem
• 4,540 points
459 views
0 votes
1 answer

Bypassing Cloudflare Scrapeshield

Scrapeshield basically checks if you are using ...READ MORE

Jun 24, 2019 in Python by SDeb
• 13,300 points
4,066 views
0 votes
1 answer

Python from Python: restricting functionality?

This doesn't seem like a good idea ...READ MORE

Jun 24, 2019 in Python by SDeb
• 13,300 points
399 views
0 votes
1 answer

How to get current time in Python?

Hi, You can use Datetime class. Input: import datetime datetime.datetime.now() Output: datetime.datetime(2019, 6, ...READ MORE

Jun 22, 2019 in Python by Taj
• 1,080 points
520 views
0 votes
1 answer

Is there a way to store a huge dataset as a dataframe using Pandas?

This can be easliy done by using ...READ MORE

Jun 22, 2019 in Python by Taj
• 1,080 points
711 views
0 votes
1 answer

How do I draw a hexagon using the turtle module of python?

Hey @Jinu, try this: import turtle polygon = ...READ MORE

Jun 23, 2019 in Python by Haseeb
6,786 views
0 votes
1 answer

How do I create a star using the turtle module of python?

Hey @Jinu, Try something like this: import turtle star = ...READ MORE

Jun 22, 2019 in Python by Neha
1,355 views
0 votes
1 answer

Draw a square using the turtle module - Python

Hey @Baily, use something like this: import turtle sq ...READ MORE

Jun 22, 2019 in Python by Himanshu
1,291 views
0 votes
1 answer

Snake head placed on the center - Python using turtle

You can use turtle's goto() function. This ...READ MORE

Jun 21, 2019 in Python by Greg
603 views
0 votes
1 answer

What does the penup() do in Python(turtle module)

penup() basically makes sure that the moving ...READ MORE

Jun 21, 2019 in Python by Iris
5,883 views
0 votes
0 answers

How to install python modules using wheeling format?

Can you show the installation of pyaudio ...READ MORE

Jun 21, 2019 in Python by Waseem
• 4,540 points
424 views
0 votes
0 answers

How do you perform selection sort in python?

Can you sort a list with n ...READ MORE

Jun 21, 2019 in Python by Waseem
• 4,540 points
372 views
0 votes
4 answers

How do I remove an element from a list by index in Python?

Delete the List and its element: We have ...READ MORE

Jun 7, 2020 in Python by sahil
• 580 points
276,653 views
0 votes
1 answer

Reverse a string in Python

You should try to use the following ...READ MORE

Feb 8, 2022 in Python by Rahul
• 9,670 points
489 views
0 votes
1 answer

How to get size of a list?

Hi, You can use built-in function "len" to ...READ MORE

Jun 21, 2019 in Python by Shabnam
• 930 points
498 views
0 votes
1 answer

How do I run a set of code for all the requests in Flask?

Hi, You can use dedicated hooks(decorators) called before ...READ MORE

Jun 21, 2019 in Python by Shabnam
• 930 points
583 views
0 votes
1 answer

What is the use of join()?

Join()  function is used in threading to ...READ MORE

Jun 20, 2019 in Python by Wajiha
• 1,950 points
421 views
0 votes
0 answers

Copy file with metadata - python

I would like to copy a file ...READ MORE

Jun 20, 2019 in Python by Trisha
440 views
0 votes
1 answer

Enter a 1-10, each on a new line in a file - python

Try something like this: i=1 for i in range(10): ...READ MORE

Jun 20, 2019 in Python by Greg
498 views
0 votes
1 answer

Open a file if it exists or create and open it does not exists - Python

You can use this: f = open("ex.txt","w+") Here the ...READ MORE

Jun 20, 2019 in Python by Jason
6,948 views
0 votes
1 answer

What is the difference between pop() and remove()?

Array elements can be removed using pop() ...READ MORE

Jun 20, 2019 in Python by Nisa
• 1,090 points
27,786 views
0 votes
1 answer

How do I read a file on only read only mode in python?

Hey @David! TRy something like this: campaign_data = ...READ MORE

Jun 20, 2019 in Python by Jason
570 views
0 votes
1 answer

How do I execute multiple SQL statements at once? - Python

You can use sqlite3 module. Have a ...READ MORE

Jun 20, 2019 in Python by Travis
29,796 views
0 votes
1 answer

More Pythonic way of counting things in a heavily nested defaultdict

You can try the following, this might ...READ MORE

Jun 20, 2019 in Python by SDeb
• 13,300 points
1,140 views
0 votes
1 answer

How to expose std::pair to python using boost::python?

The most simple example of exposing std::pair is: class_<std::pair<int, int> ...READ MORE

Jun 20, 2019 in Python by SDeb
• 13,300 points
1,082 views
0 votes
1 answer

Change the window background color using turtle - python

Try this: import turtle #set up the screen wn = ...READ MORE

Jun 19, 2019 in Python by Faiza
16,053 views
0 votes
1 answer

Change the snake head color using python turtle

You can et the snakehead color by ...READ MORE

Jun 19, 2019 in Python by Faiza
1,696 views
0 votes
0 answers

How can i perform rounding off a decimal number in python?

Can you provide the code for this? READ MORE

Jun 19, 2019 in Python by Waseem
• 4,540 points
404 views
0 votes
0 answers

How do you implement insertion sort in python?

Can you give the sample code as ...READ MORE

Jun 19, 2019 in Python by Waseem
• 4,540 points
516 views
0 votes
1 answer

Snake head now showing when trying to build the snake game using python module turtle

Hey @Nagya, so you added the following ...READ MORE

Jun 19, 2019 in Python by Faiza
1,070 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

Jun 19, 2019 in Python by Faiza
6,494 views
0 votes
1 answer

Why are Python lambdas useful?

The main purpose of anonymous functions come ...READ MORE

Jun 19, 2019 in Python by Wajiha
• 1,950 points
638 views
0 votes
1 answer

What happens when you use lambda inside lambda?

Yes you can use lambda inside lambda. ...READ MORE

Jun 19, 2019 in Python by Wajiha
• 1,950 points
1,922 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,229 views