) # 0.5414720812182742
print(xsd) # 0.15748041033663002
print(str("{6.5f}".format(xm)))
I get the following error:
IndexError: tuple index out of range
Can someone suggest me why I am getting this error and how to overcome
this?
Show us the full traceback after expanding and reducing t
) # 0.15748041033663002
print(str("{6.5f}".format(xm)))
I get the following error:
IndexError: tuple index out of range
Can someone suggest me why I am getting this error and how to overcome this?
Thanks in advance
print(str("{:6.5f}".format(xm)))
You want to apply the format 6.5
.format(xm)))
I get the following error:
IndexError: tuple index out of range
Can someone suggest me why I am getting this error and how to overcome this?
Thanks in advance
--
https://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
>> PS: How did you produce the overview over the local variables? That looks
>> nice.
> I started from this recipe:
> http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/
> made it more to my liking and turned it into a module. So that instead of
>
Antoon Pardon wrote:
>> It looks like the actual error is socket.timeout which is probably raised
>> from somewhere inside the stdlib without args.
>
> I think I know what is going on. I have my own timeout mechanism at work
> here, that works with signals and alarm. When the SIGALRM fires I just
Op 14-02-16 om 14:40 schreef Peter Otten:
>
> PS: How did you produce the overview over the local variables? That looks
> nice.
>
I started from this recipe:
http://code.activestate.com/recipes/52215-get-more-information-from-tracebacks/
made it more to my liking and turned it into a module.
>> Can anyone shed some light?
>>
>> This is the traceback:
>
> [...]
>
>> File "/usr/lib/python2.7/socket.py", line 478, in readline
>> if e.args[0] == EINTR:
>> IndexError: tuple index out of range
>
> The offending line seems
s is the traceback:
[...]
> File "/usr/lib/python2.7/socket.py", line 478, in readline
> if e.args[0] == EINTR:
> IndexError: tuple index out of range
The offending line seems to be part of
try:
data = self._sock.recv(self._rbufsize)
ex
ib.py", line 186, in getline
line = self.file.readline(self.maxline + 1)
File "/usr/lib/python2.7/socket.py", line 478, in readline
if e.args[0] == EINTR:
IndexError: tuple index out of range
Locals by frame, innermost last
Frame main in /usr/local/lib/python-apps/rmtdump/py
"/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
line = self.getline()
File "/usr/lib/python2.7/ftplib.py", line 186, in getline
line = self.file.readline(self.maxline + 1)
File "/usr/lib/python2.7/socket.py", line 478, in readline
if e.args[0] =
t ("{0} is {1} years old {3} and ".format(name, age, append))
IndexError: tuple index out of range
dan...@ibex:~/Desktop/python$
Here is my script:
#!/usr/bin/python
# Filename: str_format2.py
age = 23
name = 'Daniel'
append = '6 months
0} is {1} years old {3} and ".format(name, age, append))
IndexError: tuple index out of range
dan...@ibex:~/Desktop/python$
Here is my script:
#!/usr/bin/python
# Filename: str_format2.py
age = 23
name = 'Daniel'
append = '6 months'
print
ld {3} and ".format(name, age, append))
> IndexError: tuple index out of range
> dan...@ibex:~/Desktop/python$
>
Here is my script:
#!/usr/bin/python
> # Filename: str_format2.py
>
> age = 23
> name = 'Daniel'
> append = '6 months'
>
> print (&quo
On 21 Feb 2005 15:01:05 -0800, "John Machin" <[EMAIL PROTECTED]>
wrote:
>
>Steve M wrote:
>> John Machin wrote:
>>
>> >
>> > Steve M wrote:
>> >> I'm actually doing this as part of an exercise from a book. What
>the
>> > program
>> >> is supposed to do is be a word guessing game. The program
>auto
Steve M wrote:
> John Machin wrote:
>
> >
> > Steve M wrote:
> >> I'm actually doing this as part of an exercise from a book. What
the
> > program
> >> is supposed to do is be a word guessing game. The program
automaticly
> >> randomly selects a word from a tuple.
> >
> > Care to tell us which boo
Steven Bethard wrote:
> Steve M wrote:
>> I'm actually doing this as part of an exercise from a book. What the
>> program is supposed to do is be a word guessing game. The program
>> automaticly randomly selects a word from a tuple. You then have the
>> oportunity to ask for a hint. I created anot
John Machin wrote:
>
> Steve M wrote:
>> I'm actually doing this as part of an exercise from a book. What the
> program
>> is supposed to do is be a word guessing game. The program automaticly
>> randomly selects a word from a tuple.
>
> Care to tell us which book is using a tuple for this, but
Steve M wrote:
I'm actually doing this as part of an exercise from a book. What the program
is supposed to do is be a word guessing game. The program automaticly
randomly selects a word from a tuple. You then have the oportunity to ask
for a hint. I created another tuple of hints, where the order o
Steve M wrote:
> I'm actually doing this as part of an exercise from a book. What the
program
> is supposed to do is be a word guessing game. The program automaticly
> randomly selects a word from a tuple.
Care to tell us which book is using a tuple for this, but hasn't got to
lists yet?
Cheers,
Michael Hartl wrote:
> I actually find it strange that tuples don't have an index function,
> since finding the index doesn't involve any mutation. Anyone know why
> Python doesn't allow a statement like t.index('foo')?
>
> In any case, you can use the index method of list objects if you
> conve
Steven Bethard wrote:
> Steve M wrote:
>> I guess I explained my problem incorrectly. Let me try again.
>>
>> tuple = ("fred", "barney", "foo")
>>
>> I know that foo is an element of tuple, but what I need to know is what
>> the index of foo is, tuple[?].
>
> Larry Bates's solution is probably
Michael Hartl wrote:
I actually find it strange that tuples don't have an index function,
since finding the index doesn't involve any mutation. Anyone know why
Python doesn't allow a statement like t.index('foo')?
Tuples aren't really intended for this kind of use. See:
http://www.python.org/doc/
Steve M wrote:
I guess I explained my problem incorrectly. Let me try again.
tuple = ("fred", "barney", "foo")
I know that foo is an element of tuple, but what I need to know is what
the index of foo is, tuple[?].
Larry Bates's solution is probably the best way to go here:
py> t = ("fred", "barney"
I actually find it strange that tuples don't have an index function,
since finding the index doesn't involve any mutation. Anyone know why
Python doesn't allow a statement like t.index('foo')?
In any case, you can use the index method of list objects if you
convert your tuple to a list first:
>>
John Machin wrote:
>
> Steve M wrote:
>> Hello,
>>
>> I'm trying to figure out the index position of a tuple
> member.
>> I know the member name, but I need to know the members index
> position.
>
> Tuples, like lists, don't have members in the sense that they can be
> "named" like t.foo
Steve M wrote:
> Hello,
>
> I'm trying to figure out the index position of a tuple
member.
> I know the member name, but I need to know the members index
position.
Tuples, like lists, don't have members in the sense that they can be
"named" like t.foo. The only way of referring to them is
Larry Bates wrote:
Tuples don't have all the nice methods that lists have
so convert it to a list.
tuple=('a','b','c','d')
l=list(tuple)
now you can do:
list.index('c')
which returns 2
Remember index returns -1 when nothing is found.
No, that's .find in strings that returns -1. .index in lists rai
Tuples don't have all the nice methods that lists have
so convert it to a list.
tuple=('a','b','c','d')
l=list(tuple)
now you can do:
list.index('c')
which returns 2
Remember index returns -1 when nothing is found.
Larry Bates
Steve M wrote:
> Hello,
>
> I'm trying to figure out th
Hello,
I'm trying to figure out the index position of a tuple member.
I know the member name, but I need to know the members index position. I
know that if I use the statement print tuple[4] that it will print the
contents of that location. What I don't understand is if I know that foo is
29 matches
Mail list logo