text stringlengths 226 34.5k |
|---|
To send threekeys using send_keys() in selenium python webdriver
Question: I am trying to type a float number into a textbox with default value 0.00.But
it tries to get appended instead of overwriting it.I tried with .clear() and
then send_keys('123.00') but still it gets appended. Then i tried with
send_keys(Keys.CONT... |
Restricting the User Input to Alphabets
Question: I'm a technical writer learning python. I wanted to write a program for
validating the Name field input,as a practise, restricting the the user
entries to alphabets.I saw a similar code for validating number (Age)field
here, and adopted it for alphabets as below:
... |
Python multiprocessing pickling error
Question: I am sorry that I can't reproduce the error with a simpler example, and my
code is too complicated to post. If I run the program in IPython shell instead
of the regular python, things work out well.
I looked up some previous notes on this problem. They were all caused by... |
How to get cookies from web-browser with Python?
Question: **Context:**
_I am working on a backend access to an OpenID consumer (StackExchange in
fact). If I am to provide all possible OpenID providers as an option to the
user, then I'd have to simulate browser interaction to authenticate to each of
these providers b... |
Is it possible to return all computers in AD in python
Question: How could I search AD for all computer names?
Answer: It's not great code -- if you're familiar enough with the Windows API I'd
recommend using the `win32con` to do so. However, this is quite functional:
import subprocess
splitst... |
How to install python database library to work with robotframework - API issue
Question: I am on a Windows 7 64bit machine, using Python 2.7 and I am trying to use the
python database library in robotframework. I have previously used a java
library file but now I want to use the python library.
I have gone to [github]... |
Python closures and replacing surrounding scope
Question: I know when using Groovy closures, I can change the `delegate` on the closure
so function calls made within the closure could be defined externally.
Can I do something similar in Python?
Specifically, if you take the following code:
def configur... |
How to get string data from a python PIL image object?
Question: I'm trying to send the data of a gif file of a desktop through a socket to a
remote desktop (for desktop sharing) but i can't get the string for the data
using PIL, i don't know how to convert the Pil objects to string, here is my
code (btw i know i can j... |
How to decode POST data from github in web.py?
Question: (This question is related - but not the same - to
[this](http://stackoverflow.com/questions/8740353/how-to-convert-a-string-
data-to-a-json-object-in-python) one)
This is the POST data that I get from a github hook:
payload=%7B%22pusher%22%3A%7B%2... |
login a webpage using python and display the result in the browser
Question: I'm a beginner in python and as a learning project i decided to just make a
little script to lunch a webpage and log into it. Now after doing lots of
googling (got many messy bits and piece of knowlegde) i found out that each
website have it o... |
Error importing a .pyd file (as a python module) from a .pyo file
Question: I am running pygame (for Python) on Windows. I have some .pyo files and some
.pyd files. I have another script for somewhere else that is trying to import
one of the .pyd files as a module but I keep getting the error that no such
module exists... |
'str' object has no attribute '_meta' error come when I uncomment admin.autodiscover()
Question: I am facing this error in django:
AttributeError at /
'str' object has no attribute '_meta'
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.3
Exception Type: A... |
crawler by using urls
Question: Hi evry one i need to crawl a sit by using python(my python version is 2.6.6)
only using urls.
* first i need to open this link(<http://www.google.com/>) and crawl,and i should collect all http links which are present in this page;
* second, from the collected http links,i should go... |
Running Django Custom Management Command - Path Issues
Question: I don't understand why this doesn't find the command:
khandelwal@simba:/opt/code/cdcschool$ python schoolcommand/manage.py createcampaign
Unknown command: 'createcampaign'
Type 'manage.py help' for usage.
When this works fine:... |
Add on to: How do I protect my Python codebase so that guests can't see certain modules but so it still works?
Question: [How do I protect my Python codebase so that guests can't see certain modules
but so it still works?](http://stackoverflow.com/questions/1443146/how-do-i-
protect-my-python-codebase-so-that-guests-ca... |
Python Scraper - Socket Error breaks script if target is 404'd
Question: Encountered an error while building a web scrapper to compile data and output
into XLS format; when testing again a list of domains in which I wish to
scrape from, the program faulters when it recieves a socket error. Hoping to
find an 'if' statem... |
(GObjectIntrospection) Segmentation fault when trying to create ibus engine using javascript
Question: GObjectIntrospection allows to use C object in any high level language.
<https://live.gnome.org/GObjectIntrospection>
IBus is a input method framework for linux. code.google.com/p/ibus
I'm in bit of trouble using GO... |
"repeat" structure in Java
Question: I'm teaching programming to beginners (starting at 12-15 years old) and one of
the choices we made (because it was natural in Python) was to teach the notion
of "repeating an action" before the notion of variables.
We warted in Python with
for loop in range(10):
... |
Using Python decorators when the class def is in another file?
Question: Say I have `class myClass` in file myClass.py and I want to be able to invoke
`@myClass` without needing to clutter up my file with the myClass code.
Is this doable?
I tried importing `myClass` but it did not seem to work.
Answer:
import ... |
How to update a remote ms access database?
Question: i need to create a webapp to show and allow editing for a set of data.
This data is contained in an Access Database file, used by another application
(a desktop application).
I'm evaluating the best way to carry out this job.
Unfortunatly my purpose to migrate to ... |
Best hashing method before saving password into database table for django
Question:
def register(request):
flag = True
possible = '0123456789abcdefghijklmnopqrstuvwxyz'
token = ''
current_datetime = datetime.datetime.now()
user = UsersModelForm()
if request... |
Artefacts from Riemann sum in scipy.signal.convolve
Question: **Short summary** : How do I quickly calculate the finite convolution of two
arrays?
# Problem description
I am trying to obtain the finite convolution of two functions f(x), g(x)
defined by

To ac... |
Understanding eclipse project natures and workflow for web development
Question: I need to code some complicated web page with new html5 features, using
javascript a lot. Later I will use this as a template for Django. I was
advised to use Eclipse for JavaScript Web Developers, and to create a project
«with Javascript ... |
Pythonic way to Validate time input (only for Hr, Min, Sec)
Question: In my application,I am getting time input in a variable in string format e.g.
`Values = '12,12,12'`.
Now i need to validate it `h<24 M<60 S<60` etc. and i want final output in
`'%H:%M:%S'` format.
To get this i tried `datetime.time().`
I had 1st ... |
How do i add a python script to the startup registry?
Question: I'm trying to make my python script run upon startup but i get the error
message windowserror access denied, but i should be able to make programs
start upon boot because teamviewer ( a third-party program i downloaded ) runs
everytime i restart my compute... |
retrieve data from post requests in the form of JSON structure
Question: I am working on app engine in python, with a handler to response the post
requests from javascript, the post requests are sent in JSON structure, in
firebug console window, the Http request is shown:
[{"name":"John","value":"student... |
New-style Signal and Slot Support, PyQt
Question: I'm writing a GUI application with PyQt4 (Python3). One my friend pointed out
that using pyuic4 is a bad practice and referred me to uic module and
Connecting Slots By Name features. He didn't have time to explain more and the
references I have are rather short, I could... |
Global Variable in Python
Question: I am very new to Python. Not learnt classes yet. Using Python 3.2.2. Tried
implement some procedural C logic. My code is spread over 2 files as follows.
## this file is called date.py
dd,mm,yy=0,0,0
def isValidDate(d,m,y):
if(d>=1 and d<=31 and m>=1 a... |
What is the recommended method for creating a library with multiple classes?
Question: I am relatively new to C++ (previous experience in Python and dabbled in Java)
and I am writing a small program as a familiarization project. As part of the
program I am writing a class to decode some data and will eventually write a... |
Invalid syntax in "for item in L" loop
Question: I have a feeling I'm missing something pretty simple here but, in this one
function:
def triplets(perimeter):
triplets, n, a, b, c = 0 #number of triplets, a, b, c, sides of a triangle, n is used to calculate a triple
L = primes(int(m... |
Python ICMP ping implementation when pinging multiple ips from threads?
Question: I've been using [jedie's python `ping`
implementation](https://github.com/jedie/python-ping/blob/master/ping.py) on
Windows. I could be wrong, but when pinging two computers (A and B) from
separate threads, ping will return the first ping... |
Python: Writing output to text file, but text file does not contain the entire string and truncates randomly?
Question: I am parsing an xls file using Python then converting that information into
[SBML](http://en.wikipedia.org/wiki/SBML) (a version of XML).
from mod2sbml import Parser
s = open('... |
Splitting letters and numbers to figure out and assign value in table
Question: I currently have some code in Python where I have entered the values from a
table:
rules = { "213" : ( 0.00019, 3.5, 0.00019, 3.5 ),
"222" : ( 0.00019, 4.0, 0.00019, min( 4.0, 4.1E-8 * dm**3 - 4.1E-5 * dm**2 + 0... |
Rename Files Based on File Content
Question: Using Python, I'm trying to rename a series of .txt files in a directory
according to a specific phrase in each given text file. Put differently and
more specifically, I have a few hundred text files with arbitrary names but
within each file is a unique phrase (something lik... |
Scrapy start_urls
Question: [The
script](https://github.com/scrapy/dirbot/blob/master/dirbot/spiders/dmoz.py)
(below) from [this](http://doc.scrapy.org/en/latest/intro/tutorial.html)
tutorial contains two `start_urls`.
from scrapy.spider import Spider
from scrapy.selector import Selector
fro... |
Unpickling mid-stream (python)
Question: I am writing scripts to process (very large) files by repeatedly unpickling
objects until EOF. I would like to partition the file and have separate
processes (in the cloud) unpickle and process separate parts.
However my partitioner is not intelligent, it does not know about th... |
import data to a database from another database in python
Question: I have two databases, one is located in localhost, the other one in located in
another server.
In python, I want to import some data from database 2 to database 1:
con1 = mdb.connect (host= xx, user=xx, passwd= xx, db= xx) //connect d... |
Passing Variable to Java Through JSP?
Question: I'm wondering if it is possible to pass form data from index.jsp file to a
java class and then back to the response.jsp. I'm trying to compute something
with the data they have entered into index.jsp but it can't be done in
Javascript. Is there a way that I can retrieve t... |
Python- run socket script on the remote linux host
Question: I have uploaded the server script to the public directory on the server
machine. Then I try to connect to the server by a client, but I am not being
connected. Here is my code snippets:
# Echo client program
import socket
HOST = 'w... |
Disabling HTML Encoding within Output of Custom Python Markdown Extension
Question: I have been working on creating a python markdown extension that will insert
an image gallery within my django project when a custom tag is used. The
actual extension is working, but the HTML that the extension returns is all
encoded. H... |
Python crashing on Mac
Question: I just download a graphics module (found at
<http://mcsp.wartburg.edu/zelle/python/>) and wrote a quick program to test it
out. All it is supposed to do is create a window. It works, but the second the
window is created Python (not IDLE) goes non-responsive and I have to force
quit. Wha... |
python_d 2.7 will not load __m2crypto_d.pyd
Question: I've built python 2.7 debug with MSVC 2008 to debug a script that imports
M2Crypto. When I run my script, python_d correctly creates a Python_Eggs
cache, and copies both the __m2crypto.pyd and __m2crypto_d.pyd into it. But
then it attempts to load the non-debug pyth... |
Built-in method to Generate Random Strings of Fixed Length From Given Characters
Question: This is what my problem is: I need to make a random string 50 characters long,
made up of `1`s and `0`s.
I know how to solve this problem, and even have a one-liner for it. I have
also looked for various solutions to this proble... |
how to safely eval an urlencode-ed dictionary in Python?
Question: I should communicate with an online service that sends me the following data
urlencoded:
data_to_process = {...}
args = {'args0': data_to_process, 'action': 'save'}
result = urllib2.urlopen(..., urllib.urlencode(args), ...)
... |
Processing HTTP GET input parameter on server side in python
Question: I wrote a simple HTTP client and server in python for experienmenting. The
first code snippet below shows how I send an HTTP get request with a parameter
namely imsi. In the second code snippet I show my doGet function
implementation in the server s... |
Django redirect with kwarg
Question: I am new to python and django and i have a question regarding the redirect
function.
This is a reduced version of my views.py file.
def page_index(request, error_message=''):
print error_message
def add_page(request):
return redirect('page_in... |
osx python - how do I decode sys.argv?
Question: I don't think I'm even using funky characters - just trying to pass in a "-d"
but my dash seems to get munged. If I just print sys.argv[1] it looks okay,
but if I print the entire list sys.argv, I can see funky characters instead of
my dash. Mac OSX 10.6.8 Python 2.6.1
... |
Using BeautifulSoup to search html for string
Question: I am using BeautifulSoup to look for user entered strings on a specific page.
For example, I want to see if the string 'Python' is located on the page:
<http://python.org>
When I used: `find_string = soup.body.findAll(text='Python')` find_string
returned `[]`
Bu... |
BeautifulSoup and line breaks within a table row?
Question: Sample code:
from BeautifulSoup import BeautifulSoup, SoupStrainer
html='''<tr>
<td align="left">Foo<br />
Bar<br /></td>
</tr>'''
soup=BeautifulSoup(html)
rows=soup.findAll('tr')
print rows
print rows[0... |
ImportError: No module named mapnik (Ubuntu 10.10)
Question: An error occurred when `generate_image.py` in `/bin/mapnik` to display
image.png
dewirobiatul@dewi:~/bin/mapnik$ ./generate_image.py Traceback (most
recent call last): File "./generate_image.py", line 6, in <module>
import mapnik... |
Converter for std::vector when passed by reference
Question: This is an follow up question to [std::vector to
boost::python::list](http://stackoverflow.com/questions/6157409/stdvector-to-
boostpythonlist/8949185#8949185)
I tried the provided example:
// C++ code
typedef std::vector<std::string> MyLi... |
Python importing subdirectories
Question: I'm trying to import all files from a sub-directory, so I figured I could
write `__init__.py` in that sub-directory to import the files. However, when I
do this it does not seem to import anything.
File structure:
prog.py
module/
__init__.py
... |
How to portably parse the (Unicode) degree symbol with regular expressions?
Question: I'm writing a simple regular expression parser for the output of the `sensors`
utility on Ubuntu. Here's an example of a line of text I'm parsing:
temp1: +31.0°C (crit = +107.0°C)
And here's the regex I'm ... |
How to not import django here?
Question: I have filter that I took from django but now I must import too much of django
which I don't want and I must put the strange line in my file:
`os.environ['DJANGO_SETTINGS_MODULE'] = 'locale'`
This shouldn't be needed since I'm not using django. I use Jinja2 and I took
the floa... |
assertRises failure
Question: I'm trying to write a unit test that will ensure an HTTPException is raised
when necessary. Here is the test:
import unittest
from requests import HTTPError
import pyport
# Code omitted...
def test_bad_item_type(self):
"""A bad item type sho... |
AES Encryption in Python is different form iOS
Question: I am trying to encrypt a string in IOS and then send it to a TCP server.
Python version of code and iOS versions are shown below. Please see outputs of
the both versions. They look quite similar but the lengths are different and I
do not know the reason. Can anyb... |
Django is throwing a "[123L, 123L] is not JSON serializable"
Question: in my code i have:
json.dumps({'foo': {'bar': [123L, 123L]}})
the long ints are primary keys. this line for some reason generates the error:
"[123L, 123L] is not JSON serializable"
When i try to execute it in python manage.py ... |
Python setdefault not lvalue, any work-arounds?
Question: I have the following small program:
ages=[23,23,43,54,34,22,43,23]
histogram={}
for age in ages:
if not age in histogram:
histogram[age]=1
else:
histogram[age]+=1
for age,count in sorte... |
draw random element in numpy
Question: I have an array of element probabilities, let's say `[0.1, 0.2, 0.5, 0.2]`.
The array sums up to 1.0.
Using plain Python or numpy, I want to draw elements proportional to their
probability: the first element about 10% of the time, second 20%, third 50%
etc. The "draw" should retu... |
storages in OpenCV with Python
Question: I want to find contours in an image and further process them e.g. drawing them
on the image. To do that I have two functions running in different threads:
storage = cv.CreateMemStorage(0)
contour = cv.FindContours(inData.content, storage, cv.CV_RETR_EXTERNAL, ... |
best way to parse a big (500mb) json file and insert into mongoDB
Question: > **Possible Duplicate:**
> [Importing large json file into
> mongodb](http://stackoverflow.com/questions/5126718/importing-large-json-
> file-into-mongodb)
I have a fairly big JSON file (500+MB) that'd I'd like to edit and insert into
a da... |
Persistent python subprocess
Question: Is there a way to make a subprocess call in python "persistent"? I'm calling a
program that takes a while to load multiple times. So it would be great if I
could just leave that program open and communicate with it without killing it.
The cartoon version of my python script looks... |
Can anyone give me a quick tutorial in stdin and stdout in Python 3?
Question: I know this sounds like something I can google, but the truth is that I don't
find or do not understand what the very few Python 3 sources explains.
So here are my questions:
* Is `input()` the `stdin` function in Python 3? Does that mea... |
How to make python function always unbound even assigned to a class attribute
Question: Having the following code, what can I do with the 'foo' function to make it
unbound in any case even if it is assigned to class attribute? Overriding
__get__ doesn't help - as far as I understand because it is not used when
function... |
Python conditional 'module object has no attribute' error with personal package distinct from circular import issue
Question: I'm getting a 'module object has no attribute ..." error when trying to use a
package heirarchy I created. The error is reminiscant of the error you get
when there is a circular import (i.e. mod... |
google app engine get_serving_url() is not defined
Question: It seems like an easy problem yet I cant figure it out:
I call `get_serving_url()` function in my code and get en error:
> NameError: global name 'get_serving_url' is not defined
my import statement currently looks like: from google.appengine.api import
im... |
Python and py2exe - Implicitely Importing Modules
Question: I've used py2exe several times in the past to create *.exe files for my python
programs. However, I'm getting an error this time. I think I know what the
issue is, but I don't know how to resolve it.
I have a handful of wx.Panels in a subfolder and it could b... |
Add clr reference to WordPerfect dll using python
Question: After trying several variations on the theme of clr.AddReference, I am still
unable to add a reference to the "wpwin14.dll", which is the interop reference
for WordPerfect X4. I am using Eclipse on Windows, and other clr calls work
fine, so I assume my IronPyt... |
Running Python scripts in Java
Question: I'm trying to run a python script during the execution of my java code,
because it will depend on the output received from the python script. So far
I've tried using jythonc, unfortunately to no success, and now im trying to
use the java
[Runtime](http://docs.oracle.com/javase/1... |
isinstance() and type() equivelence failure due to import mechanism (python/django)
Question: In a Django project I'm working on I import a form in the view as follows
#views.py
from forms import SomeForm
then in a test file I have
#form_test.py
from app.forms import SomeForm... |
Python : 2d contour plot from 3 lists : x, y and rho?
Question: I have a simple problem in python and matplotlib. I have 3 lists : x, y and
rho with rho[i] a density at the point x[i], y[i]. All values of x and y are
between -1. and 1. but they are not in a specific order.
How to make a contour plot (like with imshow)... |
Why does Python CSV module make the CSV file read-only when I try to open it after running program?
Question: I'm using a program (follows) to see the similarities in certain columns
between two CSV files, then create a third when data matches certain
specifications (two columns are the same but the third is not) so th... |
Syncing directories with python's ftplib
Question: I'm learning python and trying to write a code to sync two directories: one is
on ftp server, the other is on my local disk. So far, I wrote a working code
but I have a question or two about it :)
import os
from ftplib import FTP
h_local_fil... |
My python twisted irc bot responding to commands
Question: Hello People I'm building an irc bot using python twisted, everything is built
but the bot doesn't respond to commands like i want it to. For example if i
want to call a bot command on the irc channel i want to be able to call it
like this $time and have the bo... |
Python SEM_OPEN Error
Question: I am trying to use Celery running with RabbitMQ and Django. So far i have
RabbitMQ 2.7 installed on my server, along with python 2.7 , Django 1.3,
celery 2.4.6 and django-celery 2.4.2
i followed the simple instructions here <http://django-
celery.readthedocs.org/en/latest/introduction.h... |
Makefile for C program that uses numpy extensions
Question: Please what is the simplest / most elegant way of how to determine correct
paths for numpy include as they are present on target system ? And then use it
by make command ? At the moment I am using
gcc ... -I/usr/include/python2.7/ -I/usr/lib/python2.7/site-
p... |
python-daemon context fails to start when a stale PID file is present
Question: I'm using python-daemon, and having the problem that when I `kill -9` a
process, it leaves a pidfile behind (ok) and the next time I run my program it
doesn't work unless I have already removed the pidfile by hand (not ok).
I catch all exc... |
urllib3 maxretryError
Question: I have just started using urllib3, and I am running into a problem
straightaway. According to their manuals, I started off with the simple
example:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "lice... |
Running non-django commands from a sub-directory for a Django project hosted on Heroku?
Question: I've deployed a Django application on Heroku. The application by itself works
fine. I can run commands such as `heroku run python project/manage.py
syncdb`and `heroku run python project/manage.py shell` and this works well... |
dpkt throws NeedData on valid pcap
Question: I have this python code:
import sys
import dpkt
f = file("pcaop.Pcap")
pcap = dpkt.pcap.Reader(f)
i = 0
for ts, buf in pcap:
print "Ya"
dpkt throws NeedData on the 52nd packet. The same one every time - I've
checked ... |
How to generate a repeatable random number sequence?
Question: I would like a function that can generate a pseudo-random sequence of values,
but for that sequence to be repeatable every run. The data I want has to be
reasonably well randomly distributed over a given range, it doesn't have to be
perfect.
I want to writ... |
importing target functions | multiprocessing
Question: I want to learn multiprocessing in python. I started reading
<http://www.doughellmann.com/PyMOTW/multiprocessing/basics.html> and I am not
able to understand the section on importing target functions.
In particular what does the following sentence mean..
"Wrappin... |
break two for loops
Question: > **Possible Duplicate:**
> [How to break out of multiple loops in
> Python?](http://stackoverflow.com/questions/189645/how-to-break-out-of-
> multiple-loops-in-python)
is it possible to break out of two **for** loops in Python?
i.e.
for i in range(1,100):
fo... |
getting arguments from command line python
Question: I am trying to get three arguments from command line:
-o (for outputfile) -k (number of clusters) -l (data to be clustered)
So i wrote this.
def get_input():
print 'ARGV :', sys.argv[1:]
options, remainder = getop... |
Break statement in Python
Question: I am trying to break out of a for loop, but for some reason the following
doesn't work as expected:
for out in dbOutPut:
case_id = out['case_id']
string = out['subject']
vectorspace = create_vector_space_model(case_id, string, tfidf_dict)
... |
What's the pythonic way of generating a range of chars?
Question: In other languages, I would use a construct like this:
a..z
I couldn't come up with a better solution than this:
[chr(x) for x in range(ord("a"), ord("z") + 1)]
Is there a shorter, more readable way of building s... |
Lines splines in graphic of values but y
Question: I would like to generate a graph like the link below
<http://en.wikipedia.org/wiki/Reaction_coordinate>
The graph generated from a calculation of the python library installed. I
would like the line is smooth with type cspline gnuplot
The values E_ads=234.4211 , E_di... |
Python requests exception handling
Question: How to handle exceptions with python library requests? For example how to
check is PC connected to internet?
When I try
try:
requests.get('http://www.google.com')
except ConnectionError:
# handle the exception
it gives me error name ... |
reshaping ndarrays versus regular arrays in numpy?
Question: I have an object of type 'numpy.ndarray', called "myarray", that when printed
to the screen using python's "print", looks like hits
[[[ 84 0 213 232] [153 0 304 363]]
[[ 33 0 56 104] [ 83 0 77 238]]
[[ 0 0 9 61] [ 0 0 2 ... |
Python extension (Boost.Python & Py++) and dlopen confusion
Question: I'm wrapping a C++ project with Py++/Boost.Python under Windows and Linux.
Everything in Windows is working fine, but I'm a bit confused over the
behavior in Linux. The C++ project is built into a single shared library
called libsimif, but I'd like t... |
Python: File doesn't read whole file, io.FileIO does - why?
Question: The following code, executed in python 2.7.2 _on windows_ , only reads in a
fraction of the underlying file:
import os
in_file = open(os.path.join(settings.BASEPATH,'CompanyName.docx'))
incontent = in_file.read()
in_fi... |
How to retrieve data from Google Reader?
Question: Problem: I want to download rss feed data from Google Reader. From direct feed
I could download around 20 entries, but from Google Reader I could get 5000
last posts.
My solution (that does not work):
1.) Authenticate (using this post: [Google Reader API Unread
Count... |
Python generator to return series of times
Question: I hope this is not outside of the abilities of Python generators, but I'd like
to build one so that every time the function is called, it returns the next
minute up until the end time.
So the function reads in a start and end time, and returns the time on a
minute b... |
Python string formating using values from multiple lists
Question: I'm trying to format a string using values from several lists. The following
is pseudo-code but should give an idea of the expected output. The output
would be combination of each item in each list: **each person likes to eat all
fruits while doing all ... |
extracting from a tagged corpus in python
Question: hi i'm trying exract proper noun from a tagged corpus, lets say for example-
from the nltk tagged corpus brown i'm trying to extract the words only tagged
with "NP".
my code:
import nltk
from nltk.corpus import brown
f = brown.raw('ca01')... |
How to upload files to Soundcloud using Python?
Question: I am building an application that would record what people say, generate an
audio file and upload it to SoundCloud and get the URL of the uploaded track
using Python.
I used PyAudio to record and generate an audio file - a wave file.
But I need to know how to ... |
Python expected an indented block
Question: I am a newbie to Python and would like to genereate some numbers according to
geometric distribution. i found this code on Internet but isn´t work:
import random
from math import ceil, log
def geometric(p):
# p should be in (0.0, 1.0].
... |
Parsing Python Module Docstrings
Question: Is it possible to parse module-level docstrings with the AST?
I am working on a python documenter [here](http://github.com/mvanveen/Tacco)
and visiting the module tokens and grabbing the documentation does not yield
the module-level docstring. So far, I've had to resort to im... |
Symbol Table in Python
Question: How can we see the Symbol-Table of a python source code???
I mean , Python makes a symbol table for each program before actually running
it,, So my question is how can I get that symbol-table as output???
Answer: Python is dynamic rather than static in nature. Rather than a symbol ta... |
How can python subprocess.Popen see select.poll and then later not? (select 'module' object has no attribute 'poll')
Question: I'm using the (awesome) [mrjob](http://packages.python.org/mrjob/) library
from Yelp to run my python programs in Amazon's Elastic Map Reduce. It depends
on subprocess in the standard python li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.