adjacent letters in strings

Python
Trying to write a program that will calculate the number of matching letter pairs adjacent to one another ("mississippi" contains 3) and output that n...
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

Pylint complains "no value for argument 'cls'"

Python
I have defined the following class-method to define my object from a pandas.DataFrame instead of from a list like so: class Container(object): @c...
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

How to plot a density map in python?

Python
I have a .txt file containing the x,y values of regularly spaced points in a 2D map, the 3rd coordinate being the density at that point. 4.8828125000...
3 years ago

Python Unicode Error With % Operator

Python
Not sure what I'm doing wrong here, but with this: # -*- coding: utf-8 -*- class Foo(object): CURRENCY_SYMBOL_MAP = {"CAD":'$', "USD":'$', "GBP"...
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

Saving connect statements pyqt when UI is still changing

Python
This is a project construction question. I'm building a window using QT designer, but i'm still new at it so I'm making lots of changes. I want to sta...
3 years ago

How to send Autobahn/Twisted WAMP message from outside of protocol?

Python
I am following the basic wamp pubsub examples in the github code: This example publishes messages from within the class: class Component(Application...
3 years ago

Non blocking python process or thread

Python
I have a simple app that listens to a socket connection. Whenever certain chunks of data come in a callback handler is called with that data. In tha...
3 years ago

How to sort a list with duplicate items by the biggest number of duplicate occurrences - Python

Python
I have a list1 = ["one", "two", "two", "three", "four" , "five", "five", "five", "six"] and the Output should be list2 = ["five" , "two"...
3 years ago