text stringlengths 226 34.5k |
|---|
What is the function in Python that sort files by extension?
Question:
import os
import string
os.chdir('C:\Python27')
x=os.listdir('C:\Python27')
y=[f for f in os.listdir(dirname)
if os.path.isfile(os.path.join(dirname, f))]
for k in y:
fileName, fileExtension = os.pa... |
Issues in error handling in python
Question: I am trying to bypass this error: `ItemNotFoundError: insufficient items with
name u'No_Thanks'` error by using try..except statement. However, I am getting
another error saying: `NameError: name 'ItemNotFoundError' is not defined`. I
am not sure why is this happening. Thank... |
universal python library for internalization and translation
Question: I need to internationalize and translate python application. I look forward
for some dictionary collection resides in additional resource files that could
be switched runtime and used smoothly inside python code.
I've searched stackoverflow.com for... |
Forward a port via UPnP in Python
Question: I am making a Python application that requires the user to have a port
forwarded to his computer in order to communicate with a server or another
user. The current implementation works quite great, yet the only thing is that
the person who's running the file must forward the ... |
Python 32 or 64 on 64 bit Windows 7? How will this effect installing easy_install?
Question: I wrote some python code on my mac and how I have to transfer it over to a
windows computer. This is frustrating beyond words. I installed Python 2.7
x32, then I uninstalled it, then I installed Python 2.7 x64. My python script... |
Raspberry pi 'Response IndentationError'
Question: I have been looking at a tutorial on how to send sms texts through the rasp
pi. Here is the code that I have and I'm not sure why I have an error.
#!/usr/bin/python
#-----------------------------------
# Send SMS Text Message
#
# Auth... |
Evaluation order in python list and tuple
Question: Let' say we have codes like
a = (fcn1(), fcn2())
b = [fcn1(), fcn2()]
Does python interpreter evaluate fcn1() before fcn2()? Or they can have
undefined order?
Answer: They are evaluated from [left to
right](http://docs.python.org/2/referenc... |
Python Django Admin Clean() Method not overiding values
Question: Maybe I am missing something here, but according to the django docs, I should
be able to overide values sent from an admin form from within the clean()
method. From django docs
def clean(self):
from django.core.exceptions import Va... |
parse commands with regex and python
Question: I have a string like this:
str = "something move 11 something move 12 something 13 copy 14 15"
_where the "something" means some text, or no text at all._
and as a result I want to have a list like:
[('move', 11, ''), ('move', 12, 13),... |
South, how to migrate from CharField to ForeignKey?
Question: The model:
class ListContext(models.Model):
content = models.CharField(max_length=200, blank=True)
I use south to manage schema migrations.
Now I change the previous model to this one:
from django.contrib.contentt... |
Using numpy.take for faster fancy indexing
Question: **EDIT** I have kept the more complicated problem I am facing below, but my
problems with `np.take` can be summarized better as follows. Say you have an
array `img` of shape `(planes, rows)`, and another array `lut` of shape
`(planes, 256)`, and you want to use them ... |
File to dictionary
Question: > **Possible Duplicate:**
> [Python - file to
> dictionary?](http://stackoverflow.com/questions/4803999/python-file-to-
> dictionary)
I've been looking on this website, and racking my brain, but I just can't find
the answer. I have a file of words that are matched with numbers, delimite... |
Run code from a Python module, modify module, then run again without exiting interpeter
Question: I'd like to be able to open a Python shell, execute some code defined in a
module, then modify the module, then re-run it in the same shell without
closing/reopening.
I've tried reimporting the functions/objects after mod... |
How to set self.maxDiff in nose to get full diff output?
Question: When using nose 1.2.1 with Python 3.3.0, I sometimes get an error message
similar to the following one
======================================================================
FAIL: maxdiff2.test_equal
------------------------------... |
python json encode - Missing ( and ' - urllib2.open() is ending in HTTP Error 400
Question: I am encoding a 40kb dictionary of dictionaries and lists into json and then
pushing it over http to a nosql database. I've used both jsonpickle.encode and
json.dumps modules to encode my dictionary's content, but both are leadi... |
Get list of all applications deployed on a weblogic server
Question: Using the following code, I am able to connect to the weblogic server. Now I
want to get a list of all the applications deployed on the server.
listapplications() from the command prompt lists the applications, but I am
not able to store the output i... |
Django and venv: settings.DATABASES is improperly configured. Please supply the ENGINE value
Question: This happens when I run python manage.py syncdb. It also happens when I run
python manage.py syncdb --mysite.settings. Not sure where to go from here:
django isn't recognizing my settings file and I don't know why or ... |
QApplication instance causing python shell to be sluggish
Question: My IPython shell becomes sluggish after I instantiate a QApplication object.
For example, even from a fresh start, the following code will make my shell
sluggish enough where I have to restart it.
from PyQt4 import QtGui
app = QtGui.... |
MySQL for Python: Incorrect Integer value
Question: I have the same question as asked here:
[Default value for empty integer fields when importing CSV data in
MySQL](http://stackoverflow.com/questions/5394228/default-value-for-empty-
integer-fields-when-importing-csv-data-in-mysql)
I keep getting the warning "Incorre... |
Timing a Function in Python
Question: I'm trying to time two different functions in python.
The first:
import cProfile
def bin_search(A, first,last, target):
#returns index of target in A, if present
#returns -1 if target is not present in A
if first > last:
return -1
else:
... |
Parsing HTML with Python 2.7
Question: Evening folks (or morning depending on where you are :) ).
I'm looking to parse a webpage which contains multiple segments similar to the
below:-
> <p><a name="Abercrombie"></a></p> <h3>Abercrombie Council</h3> <p>Mr
> Billy Smith<br />The Managing Director<br ... |
I would like to retrive history words from an online dictionary webpage with Python 3.2 urllib
Question: I am using [tureng](http://tureng.com) online dictionary for Turkish-English /
English-Turkish translation and this webpage records word search history and I
would like to retrive these words with this code
... |
Python Opencv SolvePnP yields wrong translation vector
Question: I am attempting to calibrate and find the location and rotation of a single
virtual camera in Blender 3d using homography. I am using Blender so that I
can double check my results before I move on to the real world where that is
more difficult. I rendered... |
How to save "complete webpage" not just basic html using Python
Question: I am using following code to save webpage using Python:
import urllib
import sys
from bs4 import BeautifulSoup
url = 'http://www.vodafone.de/privat/tarife/red-smartphone-tarife.html'
f = urllib.urlretrieve(url,... |
clean urls issue using .htaccess in php laravel project
Question: I am working on a php laravel project. I am currently facing issues with
.htaccess file. I have following .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}... |
How to write time (local system time), in text file or in log file using a Python script?
Question: I have to write a test case, for that I am using sikuli which works on a
Python script, here I am not able to write local system time in text file.
import time;
localtime = time.localtime(time.tim... |
Python calling DLL calling Python, "WindowsError: exception: access violation reading 0x00000004"
Question: I have an application written in Python.
The application calls some functions in the dll (using ctypes) that calls some
functions from the python C API to load and run some functions in a
(different) python modu... |
what's the PYTHONPATH when there is no PYTHONPATH?
Question: I need to add a new directory location to my `PYTHONPATH`, but the problem is
I'm on a clean, newly-installed system (Linux) where no `PYTHONPATH` has yet
been defined. I've read about and used `PYTHONPATH` and I thought I understood
it quite well, but I do n... |
Why Twisted Manhole ConnectionDone is an error?
Question: I'm using twisted manhole
(https://github.com/HoverHell/pyaux/blob/master/pyaux/runlib.py#L126), and I
also send errors caught by Twisted into python logging
(https://github.com/HoverHell/pyaux/blob/master/pyaux/twisted_aux.py#L9).
However, as a result, the log... |
Run multiple python functions using flask
Question: **2nd UPDATE**
Almost there!! But getting a "ValueError: Attempting to use a port that is not
open"
>
> File "c:\Python27\lib\site-packages\flask\app.py", line 1701, in
> __call__
> return self.wsgi_app(environ, start_response)
>
> File "c:\Python27\li... |
Why would anyone check 'x in list'?
Question: In Python one can very easily check if a value is contained in a container by
using the `in`-operator. I was wondering why anyone would ever use the
`in`-operator on a list, though, when it's much more efficient to first
transform the list to a set as such:
i... |
Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Question: I'm really new to Python and Django.... What I'm trying to do is:
1. Install Python 2.7 on Mac OS 10.6.8
2. Install pip Install Django
3. Install virtualenvwrapper
4. Create virtual e... |
Reading CSV - Beginner
Question: I have been trying to read a csv file from my desktop and have not been
successful. I checked my current working directory and it is pointed to my
desktop, so that doesn't seem to be the issue. Below is the module I used and
the error output that I received. I am using Python 3.2.3
... |
python mechanize submitting form kicks me back to root
Question: i have a mechanize python script written for submitting forms to inquire drug
information. and when i run it, it gives me no error message, but when i look
at the response, it's not what I see on my browser view-source page. i checked
the urls after the s... |
Jira-Python - jira.client import error
Question: I was installing jira-python like written in the docs
$ pip install jira-python
but after installation I try to run the example:
from jira.client import JIRA
options = {
'server': 'https://jira.atlassian.com'
}
jira = JIRA(options)
... |
How to make mean shift clustering work for more then five clusters?
Question: I am having troubles with mean shift clustering . It works very fast and
outputs correct results when clusters number is small (2, 3, 4) but when
clusters number increases it fails.
For example 3 clusters are detected fine: ![cluster success... |
Using requests module to export csv
Question: I'm a beginner to Python and I have been trying to export my data to a csv
file but I can't figure out how to get rid of all the brackets and my comma
separated. Ideally I need two columns: one with all values for "count" and one
with values for "month".
Any advice appreci... |
Error in collections-deque - Python
Question: I am trying to have a queue using deque in python.
The error I keep getting is index out of range
perf_his[b][c] = 0
IndexError: deque index out of range
Here is a small prototype of the code that I implemented.
import collections
... |
Concatanating array by While on Python
Question: I had some question on python,
I am trying to write something, where after each raw-input , I should input
into program some data (with array form). Then this data (arrays 2 dimensioanl
) should be added to the other 2 D array Full of zeros. Then when I input the
second... |
Random combination of letters?
Question: Using Python, how can I get a randomized combination of letters?
I want to do something like this:
def ranStr():
# some code
return random_string
So, if I call `ranStr()`, I want to get out things like (random combination of
random length of... |
How to simulate click event for a link using Qt with python
Question: I want to screen scrape a web site having multiple pages. These pages are
loaded dynamically without changing the URL.
I dont want to use Selenium since it opens browser every time you need
content.Does QT work the same way?If not, how can i simulat... |
RuntimeError: maximum recursion depth exceeded with Python 3.2 pickle.dump
Question: I'm getting the above error with the code below. The error occurs at the last
line. Please excuse the subject matter, I'm just practicing my python skills.
=)
from urllib.request import urlopen
from bs4 import Beauti... |
plot trajectories on an map using basemap
Question:
import numpy as np
data = np.loadtxt('path-tracks.csv',dtype=np.str,delimiter=',',skiprows=1)
print data
[['19.70' '-95.20' '2/5/04 6:45 AM' '1' '-38' 'CCM']
['19.70' '-94.70' '2/5/04 7:45 AM' '1' '-48' 'CCM']
['19.30' '-93.90' '2/5/04 8:... |
Execute different version of python in .vimrc file
Question: I am trying to get powerline.vim to work and the problem is that on setup it
is trying to run the wrong version of python. This line is causing the
problem.
python from powerline.ext.vim import source_plugin; source_plugin()
How can I cha... |
which one is better to test a valid url in python
Question: I want to check whether a particular url exists or not.
I came across two methods.
url = "<http://www.google.com>"
1.
import urllib2
response = urllib2.urlopen(url)
response.code # check what is the response code
2.
... |
why this python program does not work?
Question: My python program gives no error but it does not do what it supposed to do
either.
What could be possibly wrong?
Could it be that it does not have access to the imported packages?
What should I do? It is supposed to go to Yahoo! search website and query the
search ... |
NGINX, uWSGI and Flask not running subprocess
Question: My NGINX configuration:
server {
server_name 127.0.0.1;
listen 4450;
location ~* ^/.*$ {
include uwsgi_params;
uwsgi_pass unix:/tmp/esrvadmin.sock;
}
}
uWSGI start up:
uwsgi --uid root -... |
MySQL and SQLAlchemy integer diversion in WHERE clause
Question: I have a table that contains a column called `region_code` with `Integer` as
its datatype. In my Python program I have this line:
region = session.query(Region).filter(Region.region_code/100 == region_prefix).one()
The important part ... |
Calculating eigenvector centrality using NetworkX
Question: I'm using the NetworkX library to work with some small- to medium-sized
unweighted, unsigned, directed graphs representing usage of a Web 2.0 site
(smallest graph: less than two dozen nodes, largest: a few thousand). One of
the things I want to calculate is ei... |
Inputing floats, integers, or equations in raw_input to define a variable
Question: I've written this program so solve two equations based on values defined by
the user. The constants kx and ky, I've defined as floats. For the range -
variables start and end - I would like the user to either enter a number, or
somethin... |
Pandas installation on Mac OS X: ImportError (cannot import name hashtable)
Question: I would like to build pandas from source rather than use a package manager
because I am interested in contributing. **The first time** I tried to build
pandas, these were the steps I took:
1) created the virtualenv `mkvirtualenv --no... |
Twisted deferreds firing in undesired way
Question: I have the following code
# logging
from twisted.python import log
import sys
# MIME Multipart handling
import email
import email.mime.application
import uuid
# IMAP Connection
from twisted.mail import imap... |
k-means in python: Determine which data are associated with each centroid
Question: I've been using `scipy.cluster.vq.kmeans` for doing some k-means clustering,
but was wondering if there's a way to determine which centroid each of your
data points is (putativly) associated with.
Clearly you could do this manually, bu... |
IPython: redirecting output of a Python script to a file (like bash >)
Question: I have a Python script that I want to run in IPython. I want to redirect
(write) the output to a file, similar to:
python my_script.py > my_output.txt
How do I do this when I run the script in IPython, i.e. like
`execf... |
How to delete a subwindow in the python curses module
Question: I've got a curses application that uses subwindows, but I can't seem to be
able to delete them.
For example, this code doesn't work:
import curses
def fill(window, ch):
y, x = window.getmaxyx()
s = ch * (x - 1)
f... |
Handling long running tasks in pika / RabbitMQ
Question: We're trying to set up a basic directed queue system where a producer will
generate several tasks and one or more consumers will grab a task at a time,
process it, and acknowledge the message.
The problem is, the processing can take 10-20 minutes, and we're not
... |
Converting values in a list to their hashed forms (Python)
Question: I currently have the following code:
from itertools import permutations
import hashlib
def hash_f(x):
h = hashlib.md5(x)
return int(h.hexdigest(),base=16)
value = raw_input("Enter a value: ")
po... |
Python's string template changes brackets when variable is unset
Question: I have Python code which attempts to replace variables using the special
syntax $[VARIABLE] (note square brackets) and
string.template.safe_substitute(). This is working fine, with the one
exception that when an undefined variable is referenced,... |
TypeErrorException was unhandled IronPython
Question: I have a script written in python, that I am invoking using IronPython from
C#. But I run into an exception as soon as I call a method, and it throws as
exception.
This is the script that I am invoking:
import sys
import ctypes
class EAH... |
Python math module logarithm functions
Question: > **Possible Duplicate:**
> [Inaccurate Logarithm in
> Python](http://stackoverflow.com/questions/931995/inaccurate-logarithm-in-
> python)
Why are the `math.log10(x)` and `math.log(x,10)` results different?
In [1]: from math import *
In [2]: ... |
Python: how to print a variable inside a defined function separately?
Question: I want to know how to print a variable inside a function, with python, for
example:
import math
def number():
print
number_enters = input("Please enter the number: ")
square_roots = math.sqrt(numbe... |
python integer division error - modulo by zero - BUT divisor != 0
Question: I am new to doing simple math using python, so sorry if this is a silly
question.
I have 8 variables that are all set to integers and these integers are used
when performing a simple calculation.
a = 0
b = 17
c = 152
... |
Advice on robot control - image processing design architecture
Question: This is more a software engineering question than a Python question, but since
I am using Python to implement everything, any Python solution is very
welcome.
I have two classes. One class controls a robot and sends to it commands to
perform. Lik... |
Get location coordinates using bing or google API in python
Question: Here is my problem. I have a sample text file where I store the text data by
crawling various html pages. This text contains information about various
events and its time and location. I want to fetch the coordinates of these
locations. I have no ide... |
Display waiting time in text box using WXPython
Question: I want to make a application in which there are two buttons(say click & ok)
and a text box.I want to generate waiting time between clicking on two buttons
and display in text box.
**For Example:-** If I first click on CLICK Button and wait for few
seconds/minut... |
create a python shell environment launcher to use pyQgis
Question: I am trying to modify the shell launcher found at
"<http://inasafe.linfiniti.com/html/id/developer-docs/platform_windows.html>"
so that I can use it to directly launch any shell I'd like (in my case, I
wanna use the default IDLE gui in Python 27 library... |
"ImportError: No module named tkinter" when using Pmw
Question: Here's my problem: I'm running the code in
[this](http://code.activestate.com/recipes/271249-how-to-create-linked-
optionmenus-or-other-lists-in/) example. I have Python 2.7 and 3 installed on
my RaspberryPi but I have checked and double-checked, and I am ... |
How can Linux program, e.g. bash or python script, know how it was started: from command line or interactive GUI?
Question: I want to do the following:
If the bash/python script is launched from a terminal, it shall do something
such as printing an error message text. If the script is launched from GUI
session like do... |
Segmentation fault at the end of python program in Ubuntu
Question: I have a python script that seems to work in an Eclipse runtime configuration.
When I run it in at the Ubuntu command-line, I get a segmentation fault after
the main program ends. Why is it happening and how can I solve it or even
debug it?
... |
Is there a python module to solve/integrate a system of stochastic differential equations?
Question: I have a system of stochastic differential equations that I would like to
solve. I was hoping that this issue was already address. I am a bit concerned
about constructing my own solver because I fear my solver would be ... |
How to execute python script file (filename.py) using sikuli
Question: I have a python code (name.py) written in separate file and now I want to
execute that code using sikuli.
I have tried openApp but its not working could be possible I did some mistake
but still looking for working logic.
Answer: openApp is for ru... |
Can't import * from sqlalchemy.ext.declarative
Question: If I try to execute `from sqlalchemy.ext.declarative import *` it fails. I've
tried do uninstall package with `pip uninstall sqlalchemy` and reinstall it
again. I've tried removed the version from the Ubuntu repositary (the `python-
sqlalchemy`-package) but it wa... |
Iron Python and PyMongo Error
Question: I'm getting this error when I try to connect to mongodb (using pymongo) with
Iron Python...
Traceback (most recent call last):
File "test.py", line 3, in <module>
File "c:\Program Files (x86)\IronPython 2.7\lib\site-packages\pymongo\connecti
on.py",... |
Python first and last element from array
Question: I am trying to dynamically get the first and last element from an array.
So, let us suppose the array has 6 elements.
test = [1,23,4,6,7,8]
If I am trying to get the `first and last = 1,8`, `23,7` and `4,6`. Is there a
way to get elements in this ... |
How to connect to Facebook Graph API from Python using Requests if I do not need user access token?
Question: I am trying to find the easiest way how to use Facebook Graph API using my
favorite [Requests](http://docs.python-requests.org/) library. The problem is,
all examples I found are about getting **user access tok... |
ImportError while rendering: No module named app
Question: I'm running a twitter application on
[pythonanywhere](https://www.pythonanywhere.com), the app works perfectly on
localhost development server, but when I run it on
[pythonanywhere](https://www.pythonanywhere.com) I get this error:
2013-01-30 20:... |
ImportError: Django Cities
Question: I'm wondering why I am getting an `ImportError` when using [django-
cities](https://github.com/coderholic/django-cities).
from cities.models import PostalCode
I have already synced db and `cities` tables exist in the database. The
traceback:
Trace... |
How to use ddbmock with dynamodb-mapper?
Question: Can someone please explain how to set up
[dynamodb_mapper](http://pypi.python.org/pypi/dynamodb-mapper) (together with
[boto](https://github.com/boto/boto)?) to use
[ddbmock](http://pypi.python.org/pypi/ddbmock/1.0.1) with sqlite backend as
[Amazon DynamoDB](http://aws... |
how to get python to return a list?
Question: So I'm writing a python script that will clean file names of useless and
unwanted characters, but I'm running into a problem, I can't seem to figure
out how to return a list or dictionary with all of the items in it that I
iterated over. it only returns the first item I ite... |
How to replace some string with capturing group in Python 3?
Question: I'm a Python beginner. I'd like to find <(.+?)> from a string, and replace it
with [\1]. For example,
string_input = '<age>'
string_output = '[age]'
I tried,
import re
string = '<age>'
re.sub('<.+?>, '... |
Card Matching Game on Python
Question: I am current building a simple card matching game in python, with a 5x4
(row*column) grid, in which two players try to match a deck of twenty cards
(2,10 of only suit Hearts) * 2.
The problem I am running into is in iterating through the deck, printing the
cards out in a grid fas... |
Writing append only gzipped log files in Python
Question: I am building a service where I log plain text format logs from several
sources (one file per source). I do not intend to rotate these logs as they
must be around forever.
To make these forever around files smaller I hope I could gzip them in fly. As
they are l... |
python syntax error output
Question: Please could you help me by fixing the error with my code. When I print last
line I get a syntax error message:
import math
m_ = 900 # identifier for normal distribution mean [mm]
s_d = 1 # identifier for normal distribution standa... |
I need clarification on how apache works with modwsgi and pyramid
Question: We have a server that is configured to run a `pyramid+sqlalchemy` app with
`modwsgi+apache2`
We have a few things in the `__init__.py` of the pyramid app to create
database and prepopulate some test users and accounts. It is similar to the
ini... |
Receive attachment with urllib - Python
Question: I am testing my webpage software by sending requests from python to it. I am
able to send requests, receive responses and parse the json. However, one
option on the webpage is to download files. I send the download request and
can confirm that the response headers conta... |
Unescaping URL Parameter w/ Web.py
Question: Reading an url as follows:
example.com/product/xy&z
urls = ('/product/(.*)', product)
In the product class on GET I am reading the that product ID pulled (xy&z)
from the URL to create a DB query. Some of those IDs have an '&' in them, when
I receive tha... |
Python Generator Cutoff
Question: I have a generator that will keep giving numbers that follow a specific
formula. For sake of argument let's say this is the function:
# this is not the actual generator, just an example
def Generate():
i = 0
while 1:
yield i
i+... |
How do you reload and autoreload using IPython?
Question: I just installed IPython 0.13.1 and am having two problems. I have a small
'demo' project that contains an application called 'app':
.
βββ app
βΒ Β βββ __init__.py
βΒ Β βββ __init__.pyc
βΒ Β βββ models.py
βΒ Β βββ models.pyc
βΒ ... |
write() not called when subclassing code.InteractiveInterpreter
Question: When subclassing code.InteractiveInterpreter I can't seem to get the write()
method to run as I would expect per the
[documentation](http://docs.python.org/2/library/code.html).
import code
class PythonInterpreter(code.Int... |
Python subproces.call not working as expected
Question: I can not get the subprocess.call() to work properly:
>>> from subprocess import call
>>> call(['adduser', '--home=/var/www/myusername/', '--gecos', 'GECOS', '--disabled-login', 'myusername'], shell=True)
adduser: Only one or two names allow... |
Determining if a given Python module is part of the standard library
Question: How can I determine whether a Python module is part of the standard library?
In other words: is there a Python equivalent of perl's corelist utility?
I would use this to set my expectations on portability during development. In
case it's im... |
Python-based Socket program accept by libPcap(C-based)
Question: Dear all:
I use **python-based socket client** to send string data (i.e log data).
On the other hand, I use **libpcap to sniff string data on the server side**.
# But I got an error on the client side when I send string data to the server
side at the s... |
Zeroth-order Bessel function Python
Question: Apologies for the simplicity of this question.
I would like to implement an equation in Python. In this equation, K_0 is the
zeroth-order modifed Bessel function.
What is the best way of implementing K_0 in Python?
Answer: No need to implement it; it's included. See the... |
Calculating strings as values
Question: Is it possible in Python to calculate a term in a string? For example:
string_a = "4 ** (3 - 2)"
unknown_function(string_a) = 4
Is this possible? Is there a function that mimics "unknown_function" in my
example?
Thanks!
Answer: Just like `sympy` w... |
Python - include a sum in a IF condition
Question: It's probably a dumb question but I don't manage to put a sum expression in a
If condition.
I work on a CSV file composed of 3 rows A, B and C.
Here is my code :
#import and export files
test = "/home/julien/excel/test.csv"
file1 = open (... |
Automatically refresh label python
Question:
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012 Marios Papachristou mrmarios97@gmail.com
# This program is free software: you can redistribute it and/or modify it
# under the terms of the... |
How to insert value to specific cell in array in Python?
Question: I need to get 10 numbers from the user, and than calc the amount of times each
digit is appear in all the numbers.
I wrote the next code:
# Reset variable
aUserNum=[]
aDigits=[]
# Ask the user for 10 numbers
for i in... |
Unloading an Unused Module in Python (A Very Specific Case)
Question: First of all, I must tell you that I have already looked this this
[bug](http://bugs.python.org/issue9072) and I understand that the feature is
(in general) not possible for a long time. However, I have a use case which is
very specific. Hence, I wil... |
python-twitter in google app engine
Question: I am trying to use python-twitter api in GAE. I need to import Oauth2 and
httplib2.
Here is how I did
For OAuth2, I downloaded github.com/simplegeo/python-
oauth2/tree/master/oauth2. For HTTPLib2, I dowloaded
code.google.com/p/httplib2/wiki/Install and extracted folder py... |
AttributeError: 'module' object has no attribute 'TreeTagger'
Question: I am trying to use the **Python** wrapper for `TreeTagger`, a Part-of-Speech
Tagger. The code I use for importing and invoking the wrapper is:
import TreeTaggerWrapper
tagger = TreeTaggerWrapper.TreeTagger(TAGLANG='en',TAGDIR='D:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.