Jabin Jezreel wrote:
> I am not allowed to do
t = (1, *(2, 3))
>
> But I am allowed to do
def ts(*t):
> ...return t
> ...
ts(1, *(2, 3))
> (1, 2, 3)
>
> I realize I can do
(1,) + (2,3)
> (1, 2, 3)
>
> What is the rationale behind not having t = (1, *(2, 3))
> have the sam
Gurus,
I'm trying to write a fairly simple script that finds the number of hours /
minutes / seconds between now and the next Friday at 1:30AM.
I have a few little chunks of code but I can't seem to get everything to piece
together nicely.
import datetime,time
now = datetime.datetime.now()
i
On Thu, May 14, 2009 at 12:20:42PM -0700, mobiledream...@gmail.com wrote:
>How do i find which variable has error in these error messages?
>
>Nonetype object is unsubscriptable
>
>else:return web.render('searchesnew.html')
> File "/home/mark/work/common/web/cheetah.py", line 103
Cheetah is usually not run from ipython!
On Thu, May 14, 2009 at 12:40 PM, Kent Johnson wrote:
> On Thu, May 14, 2009 at 3:20 PM, wrote:
> > How do i find which variable has error in these error messages?
>
> Generally by looking at the last source line in the traceback you can
> figure it out
Forwarding to list because of mail delivery error...
2009/5/15 Sander Sweers :
> 2009/5/14 MK :
>> i am using this code to send an "cat > ThisIsMyUrl" with popen.
>
> First, I am not sure if you understand what "cat > ThisIsMyUrl"
> actually does... It waits for data on *stdin* and pipes it to
> T
"vince spicer" wrote
Take a peak at commands.getoutput
Or more "correctly" look at the subprocess module.
All previous mechanisms for process control are rendered
obsolete and are deprecated in favour of subprocess
So if we aren't using popen lets at least use subprocess.
It is slightly mo
MK wrote:
> Hi there,
>
> i am using this code to send an "cat > ThisIsMyUrl" with popen.
> Of cos cat now waits for the CTRL+D command.
> How can i send this command ?
>
> def console_command(cmd):
> print cmd
> console = os.popen(cmd,"r")
> output = console.read()
> con
import commands
On Thu, May 14, 2009 at 4:28 PM, vince spicer wrote:
> Take a peak at commands.getoutput
>
>
> EX:
>
> import commmands
>
> ls = commands.getoutput("ls- ls")
>
> Vince
>
>
> On Thu, May 14, 2009 at 3:50 PM, MK wrote:
>
>> Hi there,
>>
>> i am using this code to send an "cat > Th
Take a peak at commands.getoutput
EX:
import commmands
ls = commands.getoutput("ls- ls")
Vince
On Thu, May 14, 2009 at 3:50 PM, MK wrote:
> Hi there,
>
> i am using this code to send an "cat > ThisIsMyUrl" with popen.
> Of cos cat now waits for the CTRL+D command.
> How can i send this comm
> > >>> x = (2, 3)
> > >>> y = (1, *x)
> > File "", line 1
> > SyntaxError: can use starred expression only as assignment target
>
> But you can already do that without needing to extend * notation
> to work like that
To me the "*" notation already /appears/ to work like that:
(Python 3.x)
>>
Hi there,
i am using this code to send an "cat > ThisIsMyUrl" with popen.
Of cos cat now waits for the CTRL+D command.
How can i send this command ?
def console_command(cmd):
print cmd
console = os.popen(cmd,"r")
output = console.read()
console.close()
ret
wrote
How do i find which variable has error in these error messages?
*Nonetype object is unsubscriptable*
You need to send the entire error message, the last line is not
much good without the context. But you should see a line in
the traceback where a subscript aka indexing) operation is
The prize goes to Bob Gailer! This solution is not only shortest, but
works perfectly with negative numbers.
--
Walker Hale
On Thu, May 14, 2009 at 1:22 PM, bob gailer wrote:
> Lie Ryan wrote:
>>
>> Timo wrote:
>>>
>>> Hello,
>>>
>>> I don't think this should be difficult, so maybe I look over
On Thu, May 14, 2009 at 11:10:53AM -0700, Jabin Jezreel wrote:
> > Why not just write is simply as (1, 2, 3) instead of
> > the confusing (1, *(2, 3))?
>
> It is a contrived example. In practice it would be
> something more like:
>
> >>> def ts(*t):
> ... return t
> ...
> >>> x = (2, 3)
> >>
On Thu, May 14, 2009 at 3:20 PM, wrote:
> How do i find which variable has error in these error messages?
Generally by looking at the last source line in the traceback you can
figure it out.
IPython has an extended traceback mode that shows variables (see the
xmode magic command)
http://ipython
> Why not just write is simply as (1, 2, 3) instead of
> the confusing (1, *(2, 3))?
It is a contrived example. In practice it would be
something more like:
>>> def ts(*t):
... return t
...
>>> x = (2, 3)
>>> y = (1, *x)
File "", line 1
SyntaxError: can use starred expression only as assig
How do i find which variable has error in these error messages?
*Nonetype object is unsubscriptable*
else:return web.render('searchesnew.html')
File "/home/mark/work/common/web/cheetah.py", line 103, in render
return str(compiled_tmpl)
File
"/usr/lib/python2.5/site-packages/Cheetah-2.0.1
Lie Ryan wrote:
Timo wrote:
Hello,
I don't think this should be difficult, so maybe I look over it. But
I can't seem to find the solution.
I have a list with one word and a couple of numbers. Now I want the
word to be kept in the first location and the numbers to be sorted.
So this:
[4, 6
Christian Witts wrote:
Kent Johnson wrote:
On Thu, May 14, 2009 at 3:34 AM, Timo wrote:
Emile van Sebille schreef:
If this is always the case you can use the sort method of lists, then
relocate the last entry to the front --
a = [4, 6, 'word', 3, 9]
a.sort()
a.insert(0,a
Steve Willoughby wrote:
Lie Ryan wrote:
Jabin Jezreel wrote:
I am not allowed to do
t = (1, *(2, 3))
But I am allowed to do
def ts(*t):
return t
ts(1, *(2, 3))
(1, 2, 3)
I realize I can do
(1,) + (2,3)
(1, 2, 3)
What is the rationale behind not having t = (1, *(2, 3))
hav
Hi,
soapUrl = constants.JIRA_PATH + '/jira/rpc/soap/jirasoapservice-v2?wsdl'
soap = SOAPpy.WSDL.Proxy(soapUrl)
auth = soap.login(constants.JIRA_USERNAME,constants.JIRA_PASSWORD)
b = Types.longType(10041L)
role = soap.getProjectRole(auth,b)
project = soap.getProjectByKey(auth,'TEMP')
Now I want
Lie Ryan wrote:
> Jabin Jezreel wrote:
>> I am not allowed to do
> t = (1, *(2, 3))
>>
>> But I am allowed to do
> def ts(*t):
>> return t
>>
> ts(1, *(2, 3))
>> (1, 2, 3)
>>
>> I realize I can do
> (1,) + (2,3)
>> (1, 2, 3)
>>
>> What is the rationale behind not having
On Thu, May 14, 2009 at 9:13 AM, Lie Ryan wrote:
> Why not:
sorted(lst, key=lambda x: (0, x) if isinstance(x, str) else (1, x))
> ['word', 3, 4, 6, 9]
>
> I think sorting tuple has a well-defined meaning, i.e. sort on first item,
> then second, then third, etc... and there is AFAIK no restric
On Wed, May 13, 2009 at 1:25 PM, Alan Gauld wrote:
> def compare(x,y):
> if type(x) == str: return -1
> if type(y) == str: return 1
> return cmp(x,y)
>
>
> Runs into problems if you have multiple strings and want them sorted too...
A slight variation - if the types are the same, use c
Timo wrote:
Hello,
I don't think this should be difficult, so maybe I look over it. But I
can't seem to find the solution.
I have a list with one word and a couple of numbers. Now I want the word
to be kept in the first location and the numbers to be sorted.
So this:
[4, 6, 'word', 3, 9]
Jabin Jezreel wrote:
I am not allowed to do
t = (1, *(2, 3))
But I am allowed to do
def ts(*t):
return t
ts(1, *(2, 3))
(1, 2, 3)
I realize I can do
(1,) + (2,3)
(1, 2, 3)
What is the rationale behind not having t = (1, *(2, 3))
have the same semantics as the "ts" case abo
Le Thu, 14 May 2009 12:24:15 +0200,
Christian Witts s'exprima ainsi:
> The ability to compare unlike objects at all is considered a
> mis-feature and has been removed in Python 3:
> http://mail.python.org/pipermail/python-dev/2004-June/045111.html
Great! Thanks for the informaton, Kent.
Denis
-
"Jabin Jezreel" wrote
I am not allowed to do
>>> t = (1, *(2, 3))
Just to be clear, what do you think this means?
What would you expect to happen?
But I am allowed to do
>>> def ts(*t):
... return t
...
>>> ts(1, *(2, 3))
(1, 2, 3)
What do you think is happening here that is different?
Kent Johnson wrote:
On Thu, May 14, 2009 at 3:34 AM, Timo wrote:
Emile van Sebille schreef:
If this is always the case you can use the sort method of lists, then
relocate the last entry to the front --
a = [4, 6, 'word', 3, 9]
a.sort()
a.insert(0,a.pop())
a
On Thu, May 14, 2009 at 3:34 AM, Timo wrote:
> Emile van Sebille schreef:
>> If this is always the case you can use the sort method of lists, then
>> relocate the last entry to the front --
>>
>> >>> a = [4, 6, 'word', 3, 9]
>> >>> a.sort()
>> >>> a.insert(0,a.pop())
>> >>> a
>> ['word', 3, 4, 6,
I am not allowed to do
>>> t = (1, *(2, 3))
But I am allowed to do
>>> def ts(*t):
... return t
...
>>> ts(1, *(2, 3))
(1, 2, 3)
I realize I can do
>>> (1,) + (2,3)
(1, 2, 3)
What is the rationale behind not having t = (1, *(2, 3))
have the same semantics as the "ts" case above?
_
Emile van Sebille schreef:
On 5/13/2009 9:25 AM Timo said...
Hello,
I don't think this should be difficult, so maybe I look over it. But
I can't seem to find the solution.
I have a list with one word and a couple of numbers.
If this is always the case you can use the sort method of lists,
32 matches
Mail list logo