Let's say I have a method definition like this:
def myMethod(a, b, c, d, e)
Then, I have a variable and a tuple like this:
myVariable = 1
myTuple = (2, 3, 4, 5)
Is there a way I can pass explode the tuple so that I can pass its members as parameters? Something like this (although I know this won't work as the entire tuple is consid...
Hello all ,
I installed nose using the 'setup.py install' on the command line , I am able to run 'nosetests' and any python file matching testMatch regular expression is picked up and tests are automated in the %python home%\Scripts directory. Now I want nose to work with my iron Python files , how do I install nose on the %Iron Python ...
Is there a more Pythonic way of doing this?:
if self.name2info[name]['prereqs'] is None:
self.name2info[name]['prereqs'] = []
if self.name2info[name]['optionals'] is None:
self.name2info[name]['optionals'] = []
The reason I do this is because I need to iterate over those later. T...
Is it possible to open a mp3 file in python (possible using POPEN) and i dont mean to run it in the program i mean as a separate window in media player or whatever just for it to open it when i call the function and if so how. thanks a lot.
...
Hey everyone,
I'm dealing with a Virtuozzo server and want to automate logging into each container and issuing a few commands in Python by creating a subprocess for 'vzctl enter '.
Here is the snippet that I'm working on right now -
#!/usr/bin/python
import subprocess
print 'Start'
proc = subprocess.Popen(['vzctl enter 123'],
...
I know Python apps are faster to write, but it seems Java is the 800 lb gorilla for mobile and GUI development.
Are there any mobile platforms that run Python, or should I go the Java route?
...
I am pretty new to web programming in python.
I am interested to build a chat room on browser. (for prototype).
I know django pretty well and have done a bit of twisted in the past.
Then I came across orbited.
It's pretty badly documented (I don't think that actually qualifies for documentation anyway), but these terms seems to pop up...
In console when I'm trying output Russian characters It gives me ???????????????
Who know why?
I tried write to file - in this case the same situation.
for example
f=open('tets.txt','w')
f.write('some russian text')
f.close
inside file is - ?????????????????????????/
or
p="some russian text"
print p
?????????????
In additional...
I just installed python, mplayer, beautifulsoup and sipie to run Sirius on my Ubuntu 10.04 machine. I followed some docs that seem straightforward, but am encountering some issues. I'm not that familiar with Python, so this may be out of my league.
I was able to get everything installed, but then running sipie gives this:
/usr/bin/Si...
Hi,
I have a problem with my django application. On django developer server its work perfect, but when I switch it to apache something strange happening. Lets check the code:
class Criteria(models.Model):
district = models.ManyToManyField(District, verbose_name=u"Województwo", blank=True)
respondents = models.ManyToManyField(Us...
After messing with oauth and discovering the final leg of twitter oauth was not reliably sending back the oauth_verifier (though it seemed to authenticate anyway!), i got a bit disgruntled.
then i discovered @anywhere, the javascript twitter lib, and thought i'd give it a go.
@anywhere out of the box seems designed to allow one to do s...
I'm trying this simple code, but the damn break doesn't work... what is wrong?
while True:
for proxy in proxylist:
try:
h = urllib.urlopen(website, proxies = {'http': proxy}).readlines()
print 'worked %s' % proxy
break
except:
print 'error %s' % proxy
print 'done'
It'...
I am new to python and I have a list of years and values for each year. What I want to do is check if the year already exists in a dictionary and if it does, append the value to that list of values for the specific key.
So for instance, I have a list of years and have one value for each year:
2010
2
2009
4
1989
8
2009
7 ...
I have a function friend_exists like this:
def friend_exists(request, pid):
result = False
try:
user = Friend.objects.get(pid=pid)
except Friend.DoesNotExist:
pass
if user:
result = True
return result
I'm calling it from my other function like this:
exists = friend_exists(form.cleaned_da...
If I were to get something like this with showforms(), how would I get the Values out of the SOME_CODE input box?
Form name=ttform (#2)
## ## __Name__________________ __Type___ __ID________ __Value__________________
1 NUMBER select (None) ['0'] of ['0', '10', '2', '3', '4', ...
2 SOMEYEAR ...
Does anyone know a regular expression to match Domain.CCTLD? I don't want subdomains, only the "atomic domain". For example, docs.google.com doesn't get matched, but google.com does. However, this gets complicated with stuff like .co.uk, CCTLDs. Does anyone know a solution? Thanks in advance.
EDIT: I've realized I also have to deal with...
When you use the fileName.readlines() function in Python, is there a symbol for the end of the file that is included in the list?
For example, if the file is read into a list of strings and the last line is 'End', will there be another place in the list with a symbol indicating the end of the file?
Thanks.
...
I have a 2 classes.
One looks like this:
class Feed(db.Model):
bid = db.StringProperty()
title = db.StringProperty()
url = db.StringProperty()
datecreated = db.DateProperty(auto_now_add=True)
voice = db.StringProperty()
lastchecked = db.DateProperty(auto_now=True)
language = db.StringProperty()
active = d...
Is it possible to extend a class which has a decorator applied to it? For example:
@someDecorator
Class foo(object):
...
...
Class bar(foo):
...
...
Ideally bar would not be affected by the decorator, but first I want to find out if this is even possible. Currently I am getting a non-runtime error:
"TypeError: Error when ...
Well I am practicing slicing and want to run a program that prints a name backwards.
Mainly, I want to know how to access the last item in the sequence.
I wrote the following:
name = raw_input("Enter Your Name: ")
backname = ???
print backname
Does this look sound? Obviously, the ??? are not apart of my syntax, just asking what sho...