text stringlengths 226 34.5k |
|---|
Post xml data with auth using python
Question: I have this xml string i want to POST to an API url, i've been cheking the
docs and came up with something like this:
import urllib.request as ur
import urllib.parse as up
auth_handler = ur.HTTPBasicAuthHandler()
auth_handler.add_password(re... |
How do you import files into the Python shell?
Question: I made a sample file that uses a class called `Names`. It has its
initialization function and a few methods. When I create an instance of the
class it retrieves the instance's first name and last name. The other methods
greet the instance and say a departure mess... |
How do I get a function inside of a while loop in a function to work properly?
Question: I have looked and looked for an answer, but I am new to python and the answers
I find seem to be over my head or not quite what I need. I am trying to take
my code and turn it into multiple functions to complete the simple task of
... |
Feed google charts custom properties like color through gviz_api
Question: I'm having trouble propagating custom_properties like color into my google
chart through the python layer gviz_api.
I would like to create a bar chart with individually colored bars such as in
the example here:
<https://developers.google.com/ch... |
Parsing data for xml file in python
Question: I have the following xml file:
<address addr="x.x.x.x" addrtype="ipv4"/>
<hostnames>
</hostnames>
<ports><port protocol="tcp" portid="1"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="tcpmux" method="table" conf="3"/></port>
... |
Hit http url using python getting IOError
Question: I tried by hitting as below
import urllib
second_query="http://example.com"
pw = urllib.urlopen(second_query)
pw = pw.read()
print pw
I am trying to hit jira api -<http://example.com> but I am getting following
error
... |
Gather constant output from process (Python)
Question: I have a program that generates constant output (`hcitool lescan`):
CC:41:00:4D:AA:AA Name1
CC:41:00:4D:AA:BB Name2
CC:41:00:4D:AA:CC Name3
I would like to parse this output in `Python` constantly, but **after few
seconds I want to kill... |
Utf-8 issues with python and nltk
Question: I have this little script, which is basically just a test I'm doing for a
larger program. I have a problem with the encoding. When I try to write to
file the utf-8 characters, such as øæå, are not encoded properly. Why is that,
and how can I solve this issue?
#... |
Python: Iterate through object executing code both at certain places and also at end
Question: Here is some samplecode to explain:
outputText=""
counter=0
for obj in specialObjects:
if (obj.id < 400) or (obj.name.startswith("he")) or (obj.deliberateBreak==True):
print "The obj... |
python 2.7 interpreter exits when calling opencv's SURF detect keypoints
Question: I'm trying to compute an image's keypoints and features usinf SURF. I wrote
the following script for Python 2.7:
import cv2
# load image and conver to grayscale
ima=cv2.imread('image.png')
ima2 = cv2.cvtCo... |
Python tkinter: Replacing an image button with an image label
Question: Hi I'm trying to make a code that would replace an image button with an image
label when the button is pressed. But the window isn't updating so the new
image doesn't became visible. Can anybody help me? If it is even possible to
do that way.
Ther... |
Python tkinter: Replacing an image button with an image label by pressing the button
Question: I'm trying to change an image button to an image label. Pressing the button
should change the image of the button to label with an other image. And after
that it should still be possible to press other image buttons.
I have ... |
Python How to generate file name
Question: I was wondering if the community can help me out I'm a newbie to programming.
I trying to ssh to a list of devices contain on "list.txt" once it logs into
the router I send the same command to each one and write the output to a file.
However, on the code below it overrides the... |
ImportError: No module named 'PySide.QtCore' in python3.3 on Ubuntu
Question: I just upgraded my ubuntu to version 14.04, and since then `python3.3` cannot
import `QtCore` when calling my script; the full error output is as follows:
Traceback (most recent call last):
File "testcode.py", line 8, in ... |
Read lines starting with numbers
Question: How can I only read lines in a file that start with numbers in python i.e
Hello World <--ignore
Lovely day
blah43
blah
1234 <--read
blah12 <--ignore
blah
3124 <--read
Not matter how many words there are <--ignore
blah
0... |
Added lines in csv file python - "wb" doesnt work
Question: The code works except in the csv file there is now a blank line between each
of the values after running this - when i googled this problem it suggested
use "wb" but that returns the error
TypeError: 'str' does not support the buffer interface
... |
Python socket.create() raises an errno 10061
Question: When the client tries to connect to the server it always raise an exception. I
have disabled Windows firewall and my antivirus and I have also opened the
port 50100 on the router configuration panel.
Server:
import socket
HOST = ''
PORT... |
Can't pass variables to function with Tkinter in python
Question: I'm trying to take the textvariable from an entry(a) and then put it in a
label in a new window(w).
from Tkinter import *
def abind(avar):
print avar
w=Toplevel()
at=Label(w, text=avar).pack()
w.mainloop... |
pySerial modem result codes
Question: I'm using pySerial and python 2.7 on a Debian box. I'm writing python code to
control a USRobotics USB USR5637 modem. I want to check the responses from the
modem for issues/errors but I'm getting anomalous results from my code. I've
written some basic code for testing. I do have t... |
Creating a class in Python
Question: I am working a program for school. We are to create a "class" and I keep
getting an attribute error but I can not figure out what I wrong can someone
please help. The directions are as followed. I have also included the code
that I have written in hopes someone can help me.
> Write... |
looping for a sum versus summing a list comprehension
Question: In the sort of calculations I do, I often encounter the need to sum some
expression over (at least) one list. Let's say I want to find the sum of x^2
for x in some list L. Is there a significant difference between run times of
sum([val**2 fo... |
Problems on Windows Service written in python and py2exe
Question: I've written a service for Windows:
**agentservice.py**
import win32serviceutil
import win32service
import win32event
import win32evtlogutil
import agent
class AgentService(win32serviceutil.ServiceFramework):
... |
pywinauto error in Python 3.X
Question: I have installed "pywinauto" in Python 3.4.1 32 bit (on a Windows 7 64 bit
machine) using the command:
pip.exe install pywinauto
which gave me the following output:
> C:\Python34\Scripts>pip.exe install pywinauto Downloading/unpacking
> pywinauto Running set... |
bug of autocorrelation plot in matplotlib‘s plt.acorr?
Question: I am plotting autocorrelation with python. I used three ways to do it: 1.
pandas, 2. matplotlib, 3. statsmodels. I found the graph I got from matplotlib
is not consistent with the other two. The code is:
from statsmodels.graphics.tsaplots ... |
Using GHC's profiling stats/charts to identify trouble-areas / improve performance of Haskell code
Question: **TL;DR:** Based on the Haskell code and it's associated profiling data below,
what conclusions can we draw that let us modify/improve it so we can narrow
the performance gap vs. the same algorithm written in im... |
Combining numpy arrays to create a value field
Question: i have coded so far:
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from scipy.special import *
import matplotlib.pyplot as plt
import numpy as np
from math import *
import csv
## Globale Variabl... |
How to exchange time between C and Python
Question: I'm writing some C code that needs to embed the current time in its (binary)
output file. Later, this file will be read by some other C code (possibly
compiled for different architecture) and/or some python code. In both cases
calculations may be required on the time.... |
Python C-Api 32bit PyDict_Check Access Violation, Win7, Python 2.66
Question: I am trying to use the Python C-Api for 32bit Project in VS2010.
I have installed the 64bit and 32bit Python. To distinguish the two Versions,
I have renamed the 32bit dll to 'python26_32.dll'. I have created an according
import .lib file 'p... |
IJ.close() - Scripting python in ImageJ/FIJI
Question: I'm exceptionally new to python/scripting and I'm having a problem. I'm
writing the following in Fiji (shortened version of the script is below...)
from ij import IJ, ImagePlus
from java.lang import Runtime, Runnable
import os
f... |
Multiprocessing HTTP get requests in Python
Question: I have to make numerous (thousands) of HTTP GET requests to a great deal of
websites. This is pretty slow, for reasons that some websites may not respond
(or take long to do so), while others time out. As I need as many responses as
I can get, setting a small timeou... |
Cannot import nltk under OSX
Question: I use pip `install -U nltk` to install it. After pip list I can get nltk
(3.0.0). Also sys.path includes location of nltk.
But when run `import nltk`, it shows `ImportError: No module named nltk`
I use OSX Yosemite, python2.7
I cannot figure out why it happen. Thank you for any... |
Python Pandas read_csv issue
Question: I have simple CSV file that looks like this:
inches,12,3,56,80,45
tempF,60,45,32,80,52
I read in the CSV using this command:
import pandas as pd
pd_obj = pd.read_csv('test_csv.csv', header=None, index_col=0)
Which results in this s... |
Is it a good idea to make use different Python scripts for programs?
Question: I am wondering if it would be a good idea to use different `.py` scripts for
different parts of a Python program. Like one `.py` file for a calculator and
another for class files and etc. If it is a good idea, is it possible?
If possible, w... |
creating dynamic nested dictionary
Question: I have in file **abc.txt**
abc/pqr/lmn/xyz:pass
abc/pqr/lmn/bcd:pass
i need to parse these statements and output should be in nested dictionary as
below
{'abc':{'pqr':{'lmn':{'xyz':{'pass':1},{'bcd':{'pass':1}}}}}}
where 1 is pas... |
read a .txt and output a .xml in python3.2
Question: I wanted to know how to read a .txt file and the output should be in .xml
format.
I have the input file as
Paper 1 / White Spaces are included
Single Correct Answer Type
1. Text of question 1
a) Option 1.a b) Option 1.b
... |
python ngram reducer not returning any output?
Question: I am trying to build a mapreduce job for ngrams of google books. My mapper
works fine when tested locally but the reducer does not returns any value. The
reducer is something like below:
#! /usr/bin/env python
import sys
current_w... |
Using Regular Expressions on my Raspberry Pi
Question: Is there an editor that I could install on the Raspbian OS to practice Regex
with? If not, what about through Python? If so, is there a good python IDE out
there for Raspbian that supports Regexs?
Answer: Python itself supports regexes (via a built-in module). If... |
Python: Create Dictionary using list of list, list of tuples and list
Question: I have a list `l1` as shown below:
l1 = [[(1,"INC1"), (1, "INC2")],[(3, "INC4"),(4, "INC6")]]
I have a list `names` as shown below:
names = ['John', 'Marcia']
I have another list `label_issue_list` ... |
What kind of python magic does dir() perform with __getattr__?
Question: The following is in python 2.7 with MySQLdb 1.2.3.
I needed a class wrapper to add some attributes to objects which didn't
support it (classes with `__slots__` and/or some class written in C) so I came
out with something like this:
... |
ERROR: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file when running ogr2ogr in python script
Question: I get an error when trying to run ogr2ogr thru subprocess but I am able to run
it using just the windows command prompt. The script will be part of a series
of processes ... |
Is there an easy way to get all common module extensions?
Question: I am making a library that deals with Python modules. Without getting into
details, I need a list of the common Python module extensions.
Obviously, I want `.py`, but I'd also like to include ones such as `.pyw`,
`.pyd`, etc. In other words, I want an... |
GDAL reprojection error: in method 'Geometry_Transform', argument 2 of type 'OSRCoordinateTransformationShadow *'
Question: Using Python 2.7.9 with GDAL 1.11.1, with miniconda for package management --
Performing this a simple reprojection of a coordinate point causes the error
described below.
I am relatively new to... |
Is there a pythonic way of assigning values to variables when passed in from the command line?
Question: I have written to following code but it feels very clunky and I was wondering
if there was a pythonic way of writing the following code:
import argparse
foo = 0
bar = 1
parser = ... |
APP.YAML: Combine different URLs-same file, static file serving & source code access in app.yaml
Question: I now there are a lot of questions about app.yaml, and I searched and
searched, but this one I couldn't find.
**TLDR** : PLEASE read full answer first, this isn't your standard
application_readable:true. **I basi... |
How to make every object in a list a float
Question: I'm using Python 2. When I try to multiply objects in a list it just repeats
the same thing twice even though i have tried to use this to resolve the
issue:
map(float, prices)
The code i'm using is:
import urllib
from bs4 impor... |
Deterministic python script behaves in non-deterministic way
Question: I have a script which uses no randomisation that gives me different answers
when I run it. I expect the answer to be the same, every time I run the
script. The problem appears to only happen for certain (ill-conditioned) input
data.
The snippet com... |
EPFImporter from Itunes shows undefined symbol: _PyObject_NextNotImplemented after just installing and running
Question: I've just installed python on a new Centos 6.6 server so I can run EPFImporter
from itunes. Then I run on commandline the command:
`./EPFImporter/EPFImporter.py -D mysql itunes20141208`
I am not sur... |
Bad dataset layout
Question: I have three sets of 140+ dataset that are laid out in a weird way and I
cannot figure out how to rearrange them with Python. The files are arranged
with 4 rows on top and then 4 blanks lines followed by 5 columns. There are no
headers, rows 1 and 2 are one column, row 3 is 2 columns, and r... |
unexpected unicode values in dataframe?
Question: I can't find why this is happening. Can i get a justification ?
using pandas in python, if I write in the console:
pd.io.json.read_json('{"rCF":{"values":0.05}}')
I got printed a dataframe that looks like this
rCF
values ... |
ImportError: No module named grappellidjango.contrib
Question: **i set following<http://django-
grappelli.readthedocs.org/en/2.6.3/index.html>**
settings.py
INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
)
url.py
urlpatterns = patterns(''... |
OpenCV + Python + GigE Vision Camera
Question: I want to ask if someone have idea if it's possible to implement a
VideoCapture using OpenCV+Python and a GigE Vision Camera, I tried with
cv2.VideoCapture(0) but I am always obtaining the video of the integrated
webcam. I was trying new beta of OpenCV and using Windows
... |
Python - Observer pattern - Object has no attribute
Question: I try to run one example from the book "Python Essential Reference" involving
observer pattern, but there is a problem with attribute. When the
AccountObserver executes `__del__` the error raises - Object has no attribute
'observers'. I don't know what wrong... |
OpenCV python - Distance from Origin to Harris Corners
Question: I'm writing a python library to do basic processing on geometric images. One
of the desired functions is to return a list of distance of all corners'
distance from the origin. I'm struggling with how to do this after looking at
the print of my corner obje... |
streaming md5sum of contents of a large remote tarball
Question: I need to fetch a .tar.gz archive from an HTTP server and perform an MD5sum of
each file it contains. Since the archive is 4.5GB compressed, 12GB
decompressed, I'd like to do so without touching the hard drive. Of course I
can't keep everything in RAM eit... |
invalid elf header error for .so file
Question: I'm trying to run a script in python, and I'm getting an "invalid elf header"
error. I have a series of scripts that call one another, I'll go ahead and
include those as well:
import sys
sys.path.append("/home/smh/Linux/Desktop/gras-03-03/python")
f... |
timestamp column in sqlite return string in python
Question: i create a table with `SQLite Date Browse` App ...
when i want retrieve `datetime` value from `timestamp` column , SQLite return
unicod type ...

this is my insert code :
def... |
How to display text of listbox items in the canvas with Python3x tkiner?
Question: I am trying to display the text of the selected item of a listbox into the
canvas. When I bind the listbox to a helper event handler, it throws Attribute
Error: CLASS object has no attribute "HELPER EVENT HANDLER".
What I want is as fol... |
Name Error on MySQLDb
Question: I am working on this Python Credits on your account system, but it appears my
last for loop isn't running leading to a time_set not being defined. Does
anybody know why my last for loop isn't running. Database details have been
removed for security reasons. Here is my code:
... |
Scrapy, with Python 3.4 is failing in terminal
Question:
File "/usr/local/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
ImportError: No module named scrapy.cmdline
I am getting this when attempting to make a new project in mac terminal.
Any help would be appreciated.
Answ... |
converting a list into a HTML table in python
Question: Am having a text file where i read the content and assigning it to a variable.
I need to put the contents in a HTML table. As of now, i wrote a python
snippet to put the contents in a variable. How to convert it to a HTML table.
I need to loop through the file and... |
Value accessibility across files in Python
Question: I have a file structure as follows
Folder1:
Folder2
Class-with-global-variables-and-static-methods-to-modify-them.py
Folder2:
Myfile-1.py
Myfile-2.py
Master.py
Master.py imports the other 2 files in its folder. The " ... |
Writing and reading a new file by passing the files as an argument to a function in a python script
Question: I have a python script that gets input file names from the command prompt. I
created a list to store all the input files and pass that to a function to
create a new file with all the input files merged at once.... |
Launch a completely independent process
Question: I wanted to initiate a process from my python script `(main.py)`, specifically
I want to run the below command
`nohup python ./myfile.py &`
and this file `myfile.py` should even after my main python script exits.
Additionally I wish to get the `pid... |
python-user-agents library is not working
Question: I am trying to use the [python-user-agents](https://github.com/selwin/python-
user-agents/blob/master/user_agents/parsers.py). I keep running into a number
of bugs within the library itself.
First it referred to a `from ua_parser import user_agent_parser` that it nev... |
Python/Selenium incognito/private mode
Question: I can not seem to find any documentation on how to make Selenium open the
browser in incognito mode.
Do I have to setup a custom profile in the browser or?
Answer: First of all, since `selenium` by default starts up a browser with a clean,
brand-new profile, _you are ... |
python user input without console
Question: I have a process that runs in the background using pythonw (.pyw instead of
.py) to not show console. as I am reformatting said process for distribution I
need it to preform some first run questions that need answering. making the
user fill out a generated text file would wor... |
Extracting href ID from block of code using Python
Question: From the following code, I want to target the href and collect the ID number
at the end of the link, setting that number as a variable named "VARIABLE" (in
this block of code, the number would be "2019786"). I've used requests to
collect the page in my progra... |
Python script to compress all pdf files in a directory on Windows 7
Question: Following the code sample
[here](http://stackoverflow.com/questions/27111760/script-to-compress-all-pdf-
files-in-a-directory), I have the code below that is supposed to compress
files in a directory using Ghostscript. The code compresses the... |
Serving static file in django on Apache with mod_wsgi
Question:
<VirtualHost *:80>
ServerName test_site.com
ServerAdmin webmaster@domain.com
#<IfModule mpm_itk_module>
#AssignUserID USERNAME USERNAME
#</IfModule>
DocumentRoot /var/www/test_site.com
<Directory />
Options A... |
InfogainLoss layer
Question: I wish to use a loss layer of type
[`InfogainLoss`](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1InfogainLossLayer.html#details)
in my model. But I am having difficulties defining it properly.
1. Is there any tutorial/example on the usage of `INFOGAIN_LOSS` layer?
2. Should t... |
How to invoke super when the parent method may not be defined?
Question: Certain classes in the Python standard library (and more generally) make use
of dynamic dispatch to call specialised methods in subclasses.
For example, the
[`ast.NodeVisitor`](https://docs.python.org/3/library/ast.html) class defines
a `visit` m... |
Python PIL import Mac compatiblity
Question: I wonder now for a long time, can I redirect python imports. So on my Machine
I did:
pip install pil
and then I can do:
from PIL import Image
That works great but the problem is many programs just want Image, they want:
... |
How to reference a string in a list in python
Question: I've been writing a program (a hangman game) today, and have come across a few
snags, I know you guys don't like people just using this as answers to their
homework, but I have searched quite a while, and while I have posted this
program earlier in the development... |
Trying to crack XOR key for project (python2.7)
Question: Hi im trying to to encrypt a code then try and find the key for the code but
not getting the best results with dont know what i can do here
from itertools import izip, cycle
import itertools
import binascii
a = 0
message = "Hello f... |
How to calculate Time Between Day one and Day two (Python)
Question:
from datetime import datetime
FMT = '%H%M'
rate1 = 35.34
Midnight = "0000"
signOnSun1 = raw_input("What time did you sign on Sunday: ");
signOffSun1 = raw_input("What time did you sign off Sunday: ");
t... |
Python dateutil parser.parse("On") as today
Question: Under both Python 2.7 and 3.3.5, I am trying to parse a string to date.
>>> from dateutil import parser
>>> parser.parse("On")
datetime.datetime(2014, 12, 25, 0, 0)
Today is 2014-12-25, so it appears the result is today when parsing "On"... |
Haystack-django SyntaxError: 'return' outside function
Question: **My Search_Indexes**
from datetime import datetime
from haystack import indexes
import json
from dezign.models import dezign
class dezignIndex(indexes.SearchIndex,indexes.Indexable):
text=indexes.CharField(docu... |
Python - Launch external program and quit script?
Question: I've wrote a little script to launch a program and send a mail if a program
has quit:
#!/usr/bin/env python
# coding: utf8
import psutil
from email.mime.text import MIMEText
from subprocess import Popen, PIPE
import ... |
Computing frequencies fast in Python
Question: I need to count the frequencies of words in a corpus. Usually I use the
Counter class from the collections package.
from collections import Counter
list_of_words = ['one', 'two', 'three', 'three']
freqs = Counter(list_of_words)
However, the cor... |
How to make a ping client in Python socket?
Question: I learn Python and as a practice decided to write a server for a network game
"Backgammon". The question arose as to make sure that found in the queue
apponet still online? How to send a ping and accept the answer? I'm trying to
do it on line 71, but this is incorre... |
Need String Comparison 's solution for Partial String Comparison in Python
Question: **Scenario:** I have some tasks performed for respective "Section
Header"(Stored as String), result of that task has to be saved against same
respective "Existing Section Header"(Stored as String)
While mapping if respective task's "S... |
Learning Python The Hard Way Example 15 Python shell problems
Question: As the title says, I'm having issues with running commands through python
shell, more specifically, I can't seem to figure out how to open and read
files like it tells me to do in the study drill.
here's everything I've done so far:
... |
how to place ".py" file into the search path of your python installation
Question: I have two files say `Geometry.py` and `PeptideBuilder.py` for their
installation They need to be placed into the search path of my python
installation on ubuntu linux machine.
how can I know the search path of my python installation an... |
Unable to launch Selenium with Python in Eclipse
Question: I'm getting **Unresolved import: webdriver Found at:
selenium.webdriver.__init__ 2.44.0** issue when i'm trying to launch selenium
with **python** in **Eclipse**
My sample code
from selenium import webdriver
from selenium.common.keys import ... |
issues with six under django?
Question: I'm trying to use a package called vcrpy to accelerate the execution of my
django application test suite. I'm using django 1.7 on Mac, with Python 2.7.
I added the following couple of lines to one of my tests:
import vcr
with vcr.use_cassette('recording.yaml')... |
How to convert bytearray with non-ASCII bytes to string in python?
Question: I don't know how to convert Python's bitarray to string if it contains non-
ASCII bytes. Example:
>>> string='\x9f'
>>> array=bytearray(string)
>>> array
bytearray(b'\x9f')
>>> array.decode()
Traceback (most ... |
Python: Append Multiple Values for One Key in Nested Dictionary
Question: I have the below list of tuples:
p = [("01","Master"),("02","Node"),("03","Node"),("04","Server")]
I want my output to look like:
y = {
"Master":{"number":["01"]},
"Node":{"number":["02", "03"... |
python - Selectively choosing nucleotide sequences from a fasta file?
Question: Using biopython how can I snip genes of my interest from a fasta file if the
gene names are stored in a text file?
#extract genes
f1 = open('ortholog1.txt','r')
f2 = open('all.fasta','r')
f3 = open... |
Python Sympy MathML: mathml vs print_mathml
Question: What am I not understanding?
The following code works fine:
from sympy.printing.mathml import print_mathml
s = "x**2 + 8*x + 16"
print_mathml(s)
But this generates an error:
from sympy.printing.mathml import mathml
s ... |
MySQL with Python Flask in Openshift: Internal Server Error
Question: The first weird thing is that just fails when it's deployed in Openshift, in
my localhost works perfectly.
The issue occurs when I try to login a user(query in mysql).
<http://scheduler-sonrie.rhcloud.com/testdb> -> this test mysql connection and
s... |
Operators in sage notebook vs importing from Python
Question: Operators behave differently depending on how I run my sage program. in the
notebook:
2^10
==>1024
running my program with `sage -python filename.py`:
from sage.all import *
print(2^10)
==> 8
What do I h... |
Change directory and create a new file on remote using Chilkat SFTP python library
Question: <http://www.example-code.com/python/sftp_writeTextFile.asp>
I think I'm able to login in system using chilkat sftp `sftp =
chilkat.CkSFtp()` 30 days trial version.
now I'm in root directory(in remote machine) and there are tw... |
Html response object has not attribute text
Question:
import scrapy
from bs4 import BeautifulSoup
class Spider(scrapy.Spider):
name = "crawl"
start_urls = [url]
def parse(self, response):
soup = BeautifulSoup(response.text)
print soup.pret... |
Generate 10 balls in tkinter canvas
Question: Ok guys. I am trying to generate 10 balls of random color in Tkinter canvas
when I click the generate button. Program works, and random color choice works
for the ball, but I only get one ball generated at a time. Every time I click
the button it randomly moves the ball aro... |
Best data-structure to save a word to a corresponding number?
Question: I'm pretty new to python and just need some advice. I'm basically making a
python reddit tool that will help me find the top comments, their score, and
save them so they can be sorted by highest score at a later time.
Initially I was going to save... |
Vectorize nested for loop Python
Question: I have a numpy array that I'm iterating through with:
import numpy
import math
array = numpy.array([[1, 1, 2, 8, 2, 2],
[5, 5, 4, 1, 3, 2],
[5, 5, 4, 1, 3, 2],
[5, 5, 4, 1, 3, 2],
... |
Django case insensitive login, mixed case username
Question: I'm trying to do case insensitive login for a Django app, without altering
original username case. According to my research, the best approach is to
create a related field to store the username in lowercase at registration. No
reinventing the user model, it's... |
Can't create pdf using python PDFKIT Error : " No wkhtmltopdf executable found:"
Question: I tried installing pdfkit Python API in my windows 8 machine. I'm getting
issues related to path.
Traceback (most recent call last):
File "C:\Python27\pdfcre", line 13, in <module>
pdfkit.from_url('ht... |
Got 403 error when connecting to Google Analytics with Python 2.7.x
Question: I tried to get data from Google Analytics API with Python client(google-api-
python-client). Here's the code I used:
from apiclient import discovery
from oauth2client.client import SignedJwtAssertionCredentials
from htt... |
Print a list of words in random order - Python
Question: I have a project to complete from a book which was received as a Christmas
present (Python Programming for the Absolute Beginner, Third Edition):
_Create a program that prints a list of words in random order. The program
should print all the words and not repeat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.