text stringlengths 226 34.5k |
|---|
How to access popup login form with Selenium in Python
Question: I have been trying for a while to figure out how to enter username and
password in the popup-window in this exercise:
<http://pentesteracademylab.appspot.com//lab/webapp/digest>
but I am entirely new to Selenium in Python. I found out how to click the
b... |
Python large text file searching
Question: I have a 500 MB text file that was made a long time ago. It has what looks
like html or xml tags but they are not consistent throughout the file. I am
trying to find the information between two tags that do not match. What I am
using currently works but is very slow: myDict ha... |
Shared memory Value dissapears from an object
Question: here is some strange behavior in Python (2.7.9, Windows) I would like to ask
an advice about.
I am trying to extend a class with a variable in initialization and I want to
share an object of this class between two processes (parent and child). Both
of them will u... |
How to write python regex to find guid in html?
Question: How to find guid in following HTML section?
HTML sample:
<td>xxxxxxx</td>
<td style="display: none">e3aa8247-354b-e311-b6eb-005056b42341</td>
<td>yyyyyy</td>
<td style="display: none">e3aa8247-354b-e311-b6eb-005056b42342</td>
<td>... |
nearest timestamp price - ready data structure in Python?
Question: Price interpolation. Python data structure for efficient near miss searches?
I have price data
[1427837961000.0, 243.586], [1427962162000.0, 245.674], [1428072262000.0, 254.372], [1428181762000.0, 253.366], ...
with the first dime... |
xlsxwriter charts don't show up?
Question: I am using xlsxwriter to add charts to different worksheets in ipython and
everything works, except my graphs are never showing up in the worksheets.
There are no error messages.
When I tested the code from the documentation I also get a empty excel
workbook. I've tried it wi... |
Creating an Algorithm to generate 20 digit codes
Question: I am wanting to create an Algorithm that creates a 20 digit number code.
Similar to how gift card codes are created. I would like to use python for it,
since I know python the best out of ALL programming languages. I would like it
to create numbers based on cer... |
python forloop accessing GPIO pins
Question: I'm new to python raspberry pi. Trying to shorten my code and use for loops
for repetitive parts in my code like changing all pins to high and low.
Trying to use a for loop to access pins. Is this even possible?
import RPi.GPIO as GPIO
from time import sl... |
install python-mysqldb using python script
Question: I am writing a python script for an application. The application needs python-
mysqldb. In terminal, I can install it with apt-get or pip. How can I install
using python script? I am using python 2.7.
Answer: You could use pip in a python script for installing the ... |
Python: How many times does the least common string appear?
Question: This is a example of a csv file it is linked to the code

I want to know how to find How many times does the least common string appear
in the field [gas]
def least_string(gas):
... |
Wxpython - remove tabs in application
Question: I have a application which I have previously been using multiple tabs. I have
since changed the application and now only need a single panel. My issue is I
can't seem to figure out how I get rid of the redundant tabs and revert to a
single panel. Removing the `self.tabbed... |
What is the point of defining new class as a struct in Python C API
Question: [The docs for Python C
API](https://docs.python.org/2/extending/newtypes.html#the-basics) describes
the pattern of defining a new type:
typedef struct {
PyObject_HEAD
PyObject *first; /* first name */
Py... |
Top 3 most frequently occurring words in a string (python)
Question: Please no importing counters. I need to write a function that takes out the
top 3 most occurring words in a string and returns them in a list in the order
of most frequently occurring to least frequently occurring.
so `h("the the the the cat cat cat ... |
Use codec error handler for print() in Python3?
Question: It is well known that the `encode()` has a `error` param for codec error
handling, for example:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "发" and "财" are not available in 'big5' encoding
text = "发财了".encode('big5', errors='... |
How do I tell Python to press left mouse button at a button of a website?
Question: I want to use Python to press the left mouse button at a button of a website.
My code I'm trying:
from TKinter import *
import webbrowser
def blackdesertonline():
webbrowser.open("http://black.game.da... |
How to get a Python dict into an HTML template using Flask/Jinja2
Question: I'm trying to use a Python dict in an HTML file. The dictionary is passed to
the HTML template through the `render_template` function in Flask.
This is the format of the dict:
dict1[counter] = {
'title': l.getTitle(),
... |
Dict comprehension produces seemingly unwarranted NameError
Question: I'm using `brian2` to run neural-network simulations. In order to record data
during each simulation, I'm creating several instantiations of `brian2`'s
`SpikeMonitor` class. I want to store these monitors in a dict, created using
a dict comprehension... |
Python Packages and Modules
Question: I've never really needed to use packages and modules before in python but now
as my code base is getting bigger and bigger i'd like to structure it so its
imported easier.
I've got 10+ .py files that are all part of a package. Instead of doing
`import` each and every class when i ... |
Why is this returning two values? Easy python beginner
Question: Can someone please explain why my enter method in the following class is
returning two values? I'm learning python and in the process of creating a
simple game to grasp OOP and classes. Anyhow I need the enter method to return
a random snippet from the sn... |
GAE app main.py request handlers
Question: I have been following a GAE/Jinja2 tutorial, and thankfully it incorporates a
feature I have been struggling with within GAE, which is how to link the html
pages using the main.py file so they can be edited using Jinja2. The code for
main.py is below.
import web... |
When to use ast.literal_eval
Question: I came across this code and it works, but I am not entirely sure about **when
to use ast** and **whether there are performance issues** when this is used
instead of getting the string value from `input()` and converting it to int.
import ast
cyper_key = ast... |
AES-ECB encryption (Difference between Python Crypto.Cipher and openssl)
Question: i have a problem with encryption using python and openssl.
i wrote this small python script:
#!/usr/bin/python
from Crypto.Cipher import AES
obj = AES.new('Thisisakey123456', AES.MODE_ECB)
message = "Samp... |
How to suppress the deprecation warnings in Django?
Question: Every time I'm using the `django-admin` command — even on TAB–completion — it
throws a `RemovedInDjango19Warning` (and a lot more if I use the _test_
command). How can I suppress those warnings?
I'm using Django 1.8 with Python 3.4 (in a virtual environment... |
WXPython Maximize Frame Disable Resizing
Question: I am using Python 2.7.6 and wxPython 2.8.12.1 on Linux Mint 17.1 KDE Desktop
4.14.2. I am trying to develop an application in which the window will start
maximized and there will be no maximize box or resize box. In other words
users will not be able to resize the wind... |
Avoiding code repetition in default arguments in Python
Question: Consider a typical function with default arguments:
def f(accuracy=1e-3, nstep=10):
...
This is compact and easy to understand. But what if we have another function
`g` that will call `f`, and we want to pass on some argument... |
Cleanly unload shared library and start over with Python CFFI
Question: I'm setting up and opening a DLL like this:
from cffi import FFI
ffi = FFI()
api_path = '/path_to/api.h'
lib_path = '/path_to/lib.so'
with open(api_path) as f:
ffi.cdef(f.read())
mylib = ffi.dlopen(lib... |
Use to Chrome Store Publishing API with OAuth2 Service Account
Question: I try to update a chrome app programmatically by using the [Chrome Web Store
Publishing API](https://developer.chrome.com/webstore/using_webstore_api).
I need to use a server to server authentication method and therefor created an
oauth2 service ... |
How to translate script i python 2,7
Question: This script works in Python34 How translate in Python27?
import urllib.request, re, urllib.parse
from base64 import b64encode
import codecs
import time
def send_cap(key, fn):
print ('1')
data=open(fn, 'rb')
print ... |
Python: SocketServer closes TCP connection unexpectedly
Question: I would like to implement a TCP/IP network client application that sends
requests to a Python
[SocketServer](https://docs.python.org/2/library/socketserver.html) and
expects responses in return. I have started out with the official Python
[SocketServer s... |
Testing the equality of the sum of a digits within a number on python?
Question: for example `def f(n):`
and I wanna check whether the sum of the numbers within `n` equal to 100
whether it is in 1s, 2s, 3,s 4s, 5s and so on, depending on the length of `n`.
f(5050)
>>> True
This tests whether `... |
Python3: Calling functions saved as values (strings) in a dictionary
Question: _Background:_
I am reading a python file (.py) that has a number of functions defined and
using a regex to get the names of all the functions and store them in a list.
d_fncs = {}
list_fncs = []
with open('/home/... |
Unpack dictionary that contains a list of dictionaries and insert in columns
Question: With the data below, I'm trying to unfold a dictionary that contains a list of
dictionaries, and then group each key with the corresponding values of the
other dictionaries together. For example:
result = {
'th... |
How to get all elements between two nodes with XPATH?
Question: I have HTML code like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>test</title>
</head>
<body>
... |
choose a list by string python
Question: I'm having a problem with lists. Their are 4 list, each with a specific name:
a=[]
b=[]
c=[]
d=[]
Now I want to store values from a whole bunch of xls files in these lists. All
these xls files have a name corresponding with the list. For example:... |
zipimporter can't find/load sub-modules
Question: I'm trying to load a sub-module from a ZIP package but it won't work. How to
do it right?
**foo.zip**
foo/
__init__.py
bar.py
**test.py**
import os
import zipimport
dirname = os.path.dirname(__file__)
... |
Installing NumPy on Windows 8.1 with Python 2.7.x
Question: I'm very new to Python and programming world and has been going along with
tutorials from newcoder.io [This Here! ](http://newcoder.io/dataviz/part-0/) I
have been doing as per the instructions but when I try to install NumPy I get
an error.
" error: Microsof... |
How can I display email messages in Tkinter?
Question: I've been writing an email application in python/tkinter, where I download the
messages from my gmail then display them in a window.
The problem I keep getting though is that most messages contain html and come
out as gibberish.
Is there any way properly display ... |
Python OverflowError: math range error
Question: Similar to [Python: OverflowError: math range
error](http://stackoverflow.com/questions/4050907/python-overflowerror-math-
range-error). Below is my code, along with the error (and variable values) I
get when I try to debug. Doing math manually in python console works fi... |
Can one get hierarchical graphs from networkx with python 3?
Question: I am trying to display a tree graph of my class hierarchy using
**`networkx.`** I have it all graphed correctly, and it displays _fine_. But
as a circular graph with crossing edges, it is a pure hierarchy, and it seems
I ought to be able to display ... |
Morse code to alphanumeric (python)
Question: I need to write a program that can encode/decode messages using morse code.
To encode a message, the program needs to read an input file containing the
alphanumeric characters then output the corresponding Morse encoded message.
To decode a message, the program will read ... |
Python executable to Linux list files with sizes
Question: I need my test.py to display the following in LINUX shell \- list all files in
directory \- descending order of file size in bytes (must display bytes) \-
show total files and total size at end (X files X total size) \- does not
include sub directories or files... |
'UserCreationForm' object has no attribute 'get_username' django 1.8
Question: So I'm a newbie to django, know python enough not to call myself a beginner
but I'm by no means a pro. I'm just trying to get user authentication working
on a small django app. I'm using the default authentication system
<https://docs.django... |
matplotlib: Different Marker colour when value crosses a threshold
Question: Iam new to matplotlib and here is an image of simplified plot of the
situation: <http://postimg.org/image/qkdm6p31p/>
I would like to have a red marker for the values above a certain threshold
value, in this case, the two points above the red... |
Translating Java code to Python
Question: I'm trying translate this Java code to Python:
double grades = -32.33f;
System.out.println("grades: "+grades);
double radians = Math.toRadians(grades);
System.out.println("rad: "+radians);
long radiansUp8 = 0xFFFF_FFFFL & (long)(radias * 100_000_0... |
Maya Python - Using data from UI
Question: I am working on a scripting program and struggling a bit with the UI. I've
made a couple of UIs, all of which seem to work fine individually, but I don't
know how to use the data inputted in a UI to another function. I'm trying to
get the Gun Type (selected by the user in `Bul... |
sending email from python 3.4 script, WITHOUT enabling 'less secure apps' in gmail
Question: i would like to send mail using a python 3.4 script, from my gmail address. i
use the following code:
import smtplib
def sendmail():
sender='[email protected]'
receiver=['someone@gm... |
Using python to run bash commands and get Output
Question: I want to download videos through Youtube-he. So,I wrote program but it isn't
working.The code is
import os
l=["sets","relation_and_functions","Trig","Complex_Quad","Linear_inequalities","Permutation","Binomial","Sequence","Straight","conic",... |
Python 3 Multi-Threading with Tkinter
Question: I have been writing a bit of code that will eventually take commands from a
remote and local (within the code itself) source and and then will be carried
out and the results displayed using tkinter.
The Problem I am currently having is that when I run the code using thre... |
Using tkinter to plot pandas dataframes
Question: So I'm trying to write a small GUI that will allow an end use to plot X vs Y
of any 2 columns in an Excel file. Here's my code:
import pandas as pd
import matplotlib.pyplot as plt
import tkinter as tk
my_base=pd.read_excel('my_base.xlsx',... |
How to identify data after they have been through a whitening transformation and K-means clustering, python
Question: I am performing a K-means clustering in Python following this:
<http://glowingpython.blogspot.no/2012/04/k-means-clustering-with-scipy.html>
tutorial. I have my data, which are length, breadth and heigh... |
Find sum of first 1000 prime numbers in python
Question: I have written a program which counts the sum of the primes uptill 1000. The
program is as follows:
limit = 1000
def is_prime(n):
for i in range(2, n):
if n%i == 0:
return False
return True
... |
Syntax error while declaring path
Question: wanted to know why is it a syntax error while compiling this script if I'm
declaring a path?
I already searched a bit about it and couldn't find anything related to this,
can someone explain me how to add a path ?
if __name__ == "__main__": # This isn't pa... |
django-registration-redux add extra field
Question: 7 and python 2.7. i want to add extra field in django registration. i try to
extend with my model like this:
class Seller(models.Model):
user = models.ForeignKey(User, unique=True)
name = models.CharField(max_length=25)
... |
python: import error: no module named
Question: Out of nowhere my scripts aren't finding locations anymore, that worked
previously. The only thing i changed was to add a environmental variable in
Windows because i didn't get access python via the command line. But also
after deleting it and resetting the "PATH" variabl... |
How do I multiply each element in an array with a large number without getting OverflowError: Python int too large to convert to C long?
Question: I'm writing a program where I want to multiply each number in an array (from
numpy) with a big number (`1.692287392646066e+41`) and I do it like this:
x = arr... |
How to layout controlArea and mainArea horizontally
Question: I am trying to create a new widget for Orange 3. I see that it provides some
default areas (controlArea and mainArea) to which I can add my components. As
far as I can tell, widget.py places both of these inside 'self.leftWidgetPart'
which uses vertical orie... |
Error loading Mysqldb module in Python Django
Question: I am currently working on Ubuntu 14.10/Python/Django/MySQL and encountering
the following error when I try to run:
$python manage.py makemigrations polls
or
$python manage.py migrate polls
I have also tried syncdb The erro... |
Calculating all possible combinations using a list of random numbers and ALL simple math operators to reach a given target
Question: I am writing a simple Python script that generates 6 numbers at random (from 1
to 100) and a larger number (from 100 to 1000). My goals for this script are
to:
1. Calculate all of the ... |
Firefox sees element where PhantomJS does not when using Selenium-Webdriver
Question: I have been looking around for quite a long time now to find a solution to my
problem, hope someone here can think of something that could help.
I have a working selenium script (in Python) working with the Firefox driver
to connect ... |
Soundcloud python OAuth error
Question: This should be a fairly simple Python app which uses OAuth to authenticate
itself with the soundclodu API. It follows very closely the code for the
official library: <https://github.com/soundcloud/soundcloud-python>
When I load my app, I get sent to the soundcloud login page, wh... |
Iterating two files at same time, and compare words with strings PYTHON
Question: I'm trying to print whenever a word appears on a string, but actually it
doesn't print anything.My text files are:
words={'apple', 'banana', 'pie'}
strings={'Hello World!', 'I love pie', 'Ate an apple'}
`with open... |
Python 3: Multiprocessing API calls with exit condition
Question: I'm trying to write an application which works through a list of database
entries, making an API call with those, return the value and if one value of
the APIs JSON response is `True` for 5 calls, I want to have the list of those
5 calls. As the database... |
ReCreating threads in python
Question: I'm using the following template to recreate threads that I need to run into
infinity. I want to know if this template is scalable in terms of memory. Are
threaded destroyed properly?
import threading
import time
class aLazyThread(threading.Thread):
... |
Django cannot find contents of static/
Question: I'm trying to deploy an application to Heroku, but it cannot find my JS/CSS
files.
Here's my settings.py
# settings.py
"""
Django settings for the MyApp project.
For more information on this file, see
https://docs.djangoproject.com/en/1.... |
How can I use python xlib to generate a single keypress?
Question: I want to make a very simple python 3 script that will generate a single
keypress (F15). I don't want to use a bunch of libraries to do this as I only
need one key to be pressed and don't need support for the whole keyboard. I
know I need to use KeyPres... |
extract contact information from html with python
Question: Here is a sample html
<div class="yui3-u-5-6" id="browse-products">
<div id="kazbah-contact">
<span class="contact-info-title">Contact 00Nothing:</span>
<a href="mailto:[email protected]">[email protected]</a> | 800-410-2074
... |
How to use Pygments in Pelican with Markdown?
Question: TLDR: I am trying to do CSS line numbering in pelican, while writing in
markdown. Pygments is used indirectly and you can't pass options to it, so I
can't separate the lines and there is no CSS selector for "new line".
Using Markdown in Pelican, I can generate co... |
Conditionally replacing items in nested list based on values in dictionary
Question: Right now I have this nested list and dictionary:
phrases = [['Lionhearted', 'Baby Preach'], ['Lionhearted Baby', 'Preach'], ['Lionhearted', 'Baby', 'Preach']]
artist_info = {u'Baby': u'Baby by Justin Bieber', u'Lion... |
UnboundLocalError: local variable referenced before assignment in python closure
Question: I implemented two simple closures in Python. To me, they looks the same, but
one works and the other doesn't.
The working one is:
def makeInc(x, y):
def inc():
return y + x
return inc
... |
Keeping progress of the letters guessed in hang man python
Question:
Graphics=['''
------------
| |''','''
------------
| |
| O''','''
------------
| |
| O
| / ''','''
------------
| ... |
Removal of duplicate lines from a text file using python
Question: Earlier I wrote the code for extracting a specific string from multiple files
and the result is stored in a separate file.Now this file has duplicate
results which I need to remove .
import glob
import re
import os.path
path=r... |
Sending Multiple SMS Messages in Twilio Reply
Question: I am writing software using the Twilio API, Flask, and Python to send and
receive SMS messages. When I reply to a message, I also want to send out a
message to a different phone number (thereby sending 2 messages in total, one
to the original sender, and one to an... |
import list to excel
Question: I want to import the python list to excel. My example code is:
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = 1
wb = excel.Workbooks.Add()
ws = wb.Worksheets("Sheet1")
list1 =("a","b",... |
why does this python regex return no match?
Question:
>>> match = re.search(r'\d', 'ca\d')
>>> type(match)
<type 'NoneType'>
From my understanding 'r' means don't do any special processing with
blackslashes and just return the raw string.
Also, why do i get the output below:
>>> matc... |
Hard time catching Environment Exception in Python
Question: I have this simple code to setup a logfile at specific location: (Python
2.7.3)
import os, errno
try:
CCustomLogger.setup_daemon_logger('TRexServer', "/var/log/trex/trex_daemon_server.log")
except EnvironmentError, e:
... |
Py2exe, Runtimeerror with tweepy
Question: I wanted to use the python plugin for twitter called tweepy.
in my main.py file I just imported tweepy
import tweepy
My setup-file looks like this:
from distutils.core import setup
import py2exe
setup(
windows=[{
... |
PyQt : Manage two MainWindow
Question: i'm trying to manage two MainWindow (MainWindow & AccessWindow) with PyQt for
my RFID ACCESS CONTROL Project. I want to show the first MainWindow all time
(Endless Loop). Then, i want to hide it and show the second MainWindow when
the RFID Reader (who's working on "auto-reading mo... |
How can I fix this error with django-autocomplete-light - Importerror No Module Named Shortcuts?
Question: So, for two days now I have been struggling to set up django-autocomplete-
light to do the most basic autocompletes, but to no avail. I've ran into so
many problems and so many errors that I cannot specify them he... |
Dynamodb2 Table.get_item() throws ValidationException "The number of conditions on the keys is invalid"
Question: I am just doing a simple task in DynamoDB:
1. Create a Table,
2. Add an Item to it
3. Query the Table for that Item.
Here's a script that I am using:
from boto.dynamodb2.fields impo... |
Find what part of a string do not match with regular expression python
Question: In order to see if a filename is correctly named (using re) I use the
following regular expression pattern :
*^S_hc_[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}_[0-9]{4,4}-[0-9]{1,3}T[0-9]{6,6}\.xml$"*
Here is a correct file nam... |
XPath Syntax - Scrapy
Question: So I've been trying to find a syntax reference guide to finish off a basic
screen scraper tool using Scrapy and a Craigslist Jobs site. This is just for
practice as I learn about Scrapy more and move into more complex projects -
jumping pages, filling out search forms, etc.
This is what... |
Having python 3.4 find my custom package
Question: I wrote a package in python and now I am trying to add it to my site-packages
folder using a .pth file so that I can call it from anywhere using import
statement, but it is not working.
`sste.pth` file in my site-packages folder
/scratch/automation/sste... |
how to test mnist on my own dataset images
Question: I'm trying to test mnist using my own dataset of digits images.
I wrote a python script for that but it is giving an error. error is in line
no 16 of code. Actually i'm not able to send image for test. give me some
suggestions. thanks in advance.
imp... |
Python SIGINT not catched
Question: I don't manage to understand why my SIGINT is never catched by the piece of
code below.
#!/usr/bin/env python
from threading import Thread
from time import sleep
import signal
class MyThread(Thread):
def __init__(self):
Thread._... |
Automatically updating GET request python
Question: I have a exchange rate request that I would like to update every second. As of
now I have to re-load the program to refresh the rate. How would I go about
doing this in Python?
Any help would be appreciated, thanks in advance..
script:
import oandapy
... |
python error "ValueError: Invalid vertices array"
Question: I'm running the following code and get the following error for making the
plot. When I print the cov variable, the numbers in it have single quotes
around them. I'm assuming this is the problem? When I try to plot x and y, it
works just fine. I'm a new python ... |
How to document Matlab project with multiple classes using sphinxcontrib-matlabdomain?
Question: I tried to document a larger Matlab project using Sphinx and the
sphinxcontrib-matlabdomain package. It works fine for a single folder that
stores all .m files. However my project contains multiple classes stored in
separat... |
Django/Python: form data doesn't get stored in database
Question: Django 1.8 / Python 3.4
I wanna add data from an html-form via a Django view named "add" to my
database. However, for some reason this just doesn't happen and I can't figure
out what's wrong. Presumably the mistake is in the view's code, but what
exactl... |
pyGtk: Image prevents window resize
Question: So I am attempting to make a GTK application using python, and I have run into
this issue where after I place an image on a window, I can increase the size
of the window, but not decrease it. Given that the purpose of this particular
window is to display a resizable image, ... |
Cyclic label update in Python
Question: I'm trying to get dynamic cyclic (every half a second) label updates from a
Webservice in Python where I parse a JSON string and return its contents to
the GUI (made with Glade 3.8.1).
I have started from a basic example and the code I've written so far looks
like this:
... |
Prediction io pio train says appId does not exist
Question: I'm trying out the latest version of prediction.io (version 0.9.1). I have
installed prediction io along with its dependencies by following the tutorial
in this page: <http://docs.prediction.io/install/install-linux/>
I've added the path to the `predictionio/... |
Django error: relation "users_user" does not exist
Question: I'm getting the following error during migration:
> django.db.utils.ProgrammingError: relation "users_user" does not exist
File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in exe... |
Best algorithm to compare two lists in python
Question: I have two lists (list1 and list2) in python filled with an own datatype. I
want to compare these to lists and give all elements of these lists to
stdout(or somewhere else), but in a specific order(without sorting the lists
in any way).
List1 and List2 can have e... |
Algorithm to choose number of random numbers from list in python?
Question: I am looking for an efficient way (pseudocode will do) to choose a given
number of values randomly from the list preferably "Pythonic way". Values have
to come from unique indexes of the list
So for example:
list = [0,1,2,3,4,5,... |
Ignore additional keyword arguments in python
Question: Imagine I have a function like
def foo(x):
...
When I call it with the dictionary `{ 'x': 42, 'y': 23 }` as keyword arguments
I get an `TypeError`:
>>> foo(**{ 'x': 42, 'y': 23 })
...
TypeError: foo() got an unex... |
File does not exist: /var/www/polls
Question: Content of example.wsgi file in /var/www
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('~/.virtualenvs/menv/local/lib/python2.7/site-packages')
# Add the app's directory to t... |
How to find 6 digits in a string in python?
Question: An example string is `"CPLR_DUK10_772989_2"`. I want to pick out `"772989"`
specifically. I would imagine using `re.findall` is a good way to go about it,
however, I don't have a very good grasp on regular expression so I find myself
stumped on this one.
Here is a ... |
python:assignment of list item as true and false
Question: I have a Python list and I want to assign all possible combinations of `True`
and `False` values to all the elements of the list.
Suppose I have list `list1 = ['a', 'b']`, so I want a new list as
`[['t','t'],['t','f'],['f','t'],['f','f']]`, which are all the p... |
reduce datetime list by timedelta
Question: in python, how I can reduce a datetime list by a timedelta neighborhood?
If I have
dates = [
dt.datetime(1970, 1, 1, 0, 2),
dt.datetime(1970, 1, 1, 0, 3),
dt.datetime(1970, 1, 1, 0, 7),
dt.datetime(1970, 1, 1... |
Python selenium is_displayed method
Question: I want to be able to reach the else statement and not get an exceptions when
the element is not displayed.
for example:
if driver.find_element_by_xpath("/html/body/main/div/article[2]/div[4]/header/div[2]/div/div[3]/a[4]").is_displayed():
pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.