installing request module in python 2.7 windows

Python
I am facing issues while installing request module (python 2.7) on windows. Tries the below steps as per docuemntation: 1 pip install requests er...
3 years ago

while (1) Vs. for while(True) -- Why is there a difference?

Python
Intrigued by this question about infinite loops in perl: http://stackoverflow.com/questions/885908/while-1-vs-for-is-there-a-speed-difference, I decid...
3 years ago

How to do multiple arguments with Python Popen?

Python
I am trying to make a PyGtk Gui, that has a button. When the user presses this button, gnome-terminal prompts the user to write their password. Then ...
3 years ago

Python for .NET "unable to find assembly" error

Python
I'm using CPython and I have a C# dll. I'm trying to use Python for .NET to make them talk. I can't use IronPython because I need to integrate this ...
3 years ago

Python lambda function to calculate factorial of a number

Python
I have just started learning python. I came across lambda functions. On one of the problems, the author asked to write a one liner lambda function for...
3 years ago

How to print substring using RegEx in Python?

Python
This is two texts: 1) 'provider:sipoutilp1.ym.ms' 2) 'provider:sipoutqtm.ym.ms' I would like to print ilp when reaches to the fist line and qtm wh...
3 years ago

Separating positive and negative values of pandas DataFrame

Python
I need to separately sum all positive and negative values in a column ie pos_values = [x for x in df.prediction_at_ohlcv_end_date if x > 0] neg_...
3 years ago

How do I avoid the "self.x = x; self.y = y; self.z = z" pattern in __init__?

Python
I see patterns like def __init__(self, x, y, z): ... self.x = x self.y = y self.z = z ... quite frequently, often with a lot mo...
3 years ago

Creating a timer in python

Python
import time def timer(): now = time.localtime(time.time()) return now[5] run = raw_input("Start? > ") while run == "start": minutes = 0 ...
3 years ago

Finding Words In List

Python
I am trying to make something that finds where a word is in a list and then tells you where it is here is what i have so far: whenAppears = 0 when = ...
3 years ago

Numpy: Quick setting of array elements

Python
I just came across a showstopper for a part of my code and I am not sure what I am doing wrong... I simply have a large data cube and want to change ...
3 years ago

What exactly do "u" and "r" string flags do in Python, and what are raw string literals?

Python
While asking this question, I realized I didn't know much about raw strings. For somebody claiming to be a Django trainer, this sucks. I know what an...
3 years ago

Jinja2 round filter not rounding

Python
I have the following code in my template: data: [{% for deet in deets %} {{ deet.value*100|round(1) }}{% if not loop.last %},{% endif %} {% endfor %}...
3 years ago

why is logged_out.html not overriding in django registration?

Python
I am using built-in django login and logout. In my Project/urls.py i have added url's for both login and logout. from django.conf.urls import include...
3 years ago

Accessing global variable in local environment

Python
Consider this code: Var='global' def func(): Var='local' #global Var print Var I'm trying to print the global variable even though I...
3 years ago

Python Brute Forcer?

Python
I had a general idea in mind for a way to brute force a password, but being just a python novice, i'm not sure where to go from here... So far I have...
3 years ago

Numpy matrix multiplication of 2d matrix to give 3d matrix

Python
I have two numpy arrays, like A: = array([[0, 1], [2, 3], [4, 5]]) B = array([[ 6, 7], [ 8, 9], ...
3 years ago

Python - search a list for items in another list

Python
I have a question which is probably easy, but I can't figure it out. I have a list "l" and I want to find matches from the strings in "q". If I search...
3 years ago

Python check for valid email address?

Python
Is there a good way to check a form input using regex to make sure it is a proper style email address? Been searching since last night and everybody t...
3 years ago

How do I check if the list contains empty elements?

Python
Suppose I have a empty string, it will be split: >>>''.split(',') [''] The result of the split is ['']. I use bool to check it whether or ...
3 years ago