I was wondering if it's frowned upon to use the decorator module that comes with python. Should I be creating decorators using the original means or is it considered okay practice to use the module?
How would you write a list comprehension in python to generate a series of n-1 deltas between n items in an ordered list?
Example:
L = [5,9,2,1,7]
RES = [5-9,9-2,2-1,1-7] = [4,7,1,6] # absolute values
Hi, I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example?
Thanks!
Is there a way I can programmatically determine the status of a download in Chrome or Mozilla Firefox? I would like to know if the download was aborted or completed successfully.
For writing the code I'd be using either Perl, PHP or Python.
Please help.
Thank You.
Im trying to count how many repeated lists there are inside a list. But it doesnt work the same way I could count repeated elements in just a list. Im fairly new to python, so apologies if it sounds too easy.
this is what i did
x= [["coffee", "cola", "juice" "tea" ],["coffee", "cola", "juice" "tea"]
["cola", "coffee", "juice" "tea" ]]
dictt= {}
for item in x:
dictt[item]= dictt.get(item, 0) +1
return(dictt)
hey dudes,
my first question anyway,
i have made a single user dungeon and am looking to change it in to a multi user dungoen how can i do this by the way im using python to make the sud in to a mud lol
https://search.twitter.com/search.json?q=doug
How do I read this like VIEW SOURCE, so that I know what I'm looking at?
Is there a website that can prettify it for me?
BTW, I use python
Hi all,
i am quite new in python.
I am receiving (through pyserial) string with data values.
How can I parse these data to particular data structure?
I know that
0-1 byte : id
2-5 byte : time1 =>but little endian (lsb first)
6-9 byte : time2 =>but little endian (lsb first)
and I looking for a function:
def parse_data(string):
data={}
data['id'] = ??
data['time1'] = ??
data['time2'] = ??
return data
thanks
This is happening in python files.
For example, I want to do type "fC" in normal mode, and instead of finding the first "C" character, it is just doing code fold toggling.
It looks like Google hasn't updated the results section since the Q4 2009 posting. I've been wondering when it will be put in the Python trunk, and if it's, in any way, production ready.
Also, "We aspire to do no original work" is in the Q4 plan. Did Google bite off more than what they could handle, or does anyone know what the real story is?
Hi all,
I recently installed twython, a really sleek and awesome twitter API wrapper for Python. I installed it and it works fine from the interpreter, but when I try to import it via Eclipse, it says that twython is an invalid import.
How do I "tell" eclipse where twython is so that it will let me import and use it?
Thanks!
I need to run a lot of Django management commands in the crontab and want to log the output of each run to a special timestamped file. Is there a Django or Python module to help me do this or do I just have to roll my own?
I know about os.nice() it works perfect for parent process, but I need to do renice of my child subprocesses. I found way to do this, but it seems to be not very handy and too excessive:
os.system("renice -n %d %d" % ( new_nice, suprocess.pid ) )
And it isn't return resulting nice level after renicing.
Is there more clean way to renice subprocesses in python?
Can any one tell me which MySQL version is suitable for Python2.6.1 to connect MySQLdb,
I am using MySQL4.0.23 and MySQLdb of MySQL-python-1.2.3c1.win32-py2.6 after successfully installation also its showing No module named MySQLdb and I sent the Environment Variables also properly for Python2.6, using Windows XP, tested import MySQLdb through command prompt its not showing any errors
then what could be the problem, I am straggling on this since last 2days, Please tell what could be the problem
isk-daemon software permits setting feature parameters?
I download desktop version and apparently not!
There are alternative libraries or software which is not all automatic?
I have a set of images and i only want to pick up an image, extract some features and compare them with this set of image, basing on a similarity metric that give me a percentage result like isk-daemon but with more freedom in settings, better in python!
I'm using Pisa/XHTML2PDF to generate PDFs on the fly in Django. Unfortunately, I need to include SVG images as well, which I don't believe is an easy task.
What's the best way to go about either a) converting the SVGs to PNG / JPG (in Python) or b) including SVGs in the PDF export from Pisa?
Hello,
I have the following code in Python:
linkHTML = "<a href=\"page?q=%s\">click here</a>" % strLink
The problem is that when strLink has spaces in it the link shows up as
<a href="page?q=with space">click here</a>
I can use strLink.replace(" ","+")
But I am sure there are other characters which can cause errors. I tried using
urllib.quote(strLink)
But it doesn't seem to help.
Thanks!
Joel
I have the following file like this:
2 qid:1 1:0.32 2:0.50 3:0.78 4:0.02 10:0.90
5 qid:2 2:0.22 5:0.34 6:0.87 10:0.56 12:0.32 19:0.24 20:0.55
...
he structure is follwoing like that:
output={}
rel=2
qid=1
features={} # the feature list "1:0.32 2:0.50 3:0.78 4:0.02 10:0.90" output.append([rel,qid,features])
...
How can I write my python code to load the data, thanks
Hey,
Im wondering, how can i get a SUM of a rating entity i get from the datastore (python)?
should i:
ratingsum = 0
for rating in ratings:
ratingsum + rating
print ratingsum
?
i found this code in http://code.google.com/p/verysmallforumforgae/ manin.py:
from django.core.paginator import ObjectPaginator
but i can't find ObjectPaginator ,my python's version is 2.5
where is it ?
thanks
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming.
I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my limited experience with OOP.
Am I missing something by not trying harder to use objects, or does OOP just not make a lot of sense for small scripts?
Would what mentioned in the title be possible? Python module style that is. See this example for what I exactly mean.
index.php
<?php
use Hello\World;
World::greet();
Hello/World.php
<?php
namespace Hello\World;
function greet() { echo 'Hello, World!'; }
Would this be possible?