Python Forum
code with no tuple gets : IndexError: tuple index out of range
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code with no tuple gets : IndexError: tuple index out of range
#5
(Nov-03-2020, 04:32 PM)bowlofred Wrote: Without the code, we can't help much. But the error suggests that one of those variables is a tuple and the index is too large.

Before the if you could print the types of them:
print(f"dataseg is of type {type(dataseg)} and has {len(dataseg)} elements.")
print(f"lines is of type {type(lines)} and has {len(lines)} elements.")
That won't tell you why you have a tuple, but it will tell you which one it is and its length.

I fixed i,Thanks for your help!
Reply


Messages In This Thread
RE: code with no tuple gets : IndexError: tuple index out of range - by Aggam - Nov-04-2020, 11:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  using > < for tuple , list,... akbarza 3 469 Feb-05-2024, 01:18 PM
Last Post: deanhystad
Sad UnpicklingError: NEWOBJ expected an arg tuple. biyazelnut 0 456 Dec-20-2023, 03:16 AM
Last Post: biyazelnut
  Searche each element of each tuple based 3 numbes zinho 8 858 Dec-11-2023, 05:14 PM
Last Post: zinho
  tuple indices must be integers or slices, not str cybertooth 16 11,462 Nov-02-2023, 01:20 PM
Last Post: brewer32
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 470 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  IndexError: index 10 is out of bounds for axis 0 with size 10 Mehboob 11 2,086 Sep-14-2023, 06:54 AM
Last Post: Mehboob
  Change font in a list or tuple apffal 4 2,670 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
Thumbs Down I hate "List index out of range" Melen 20 3,306 May-14-2023, 06:43 AM
Last Post: deanhystad
  search in dict inside tuple steg 1 685 Mar-29-2023, 01:15 PM
Last Post: rob101
Exclamation IndexError: Replacement index 2 out of range for positional args tuple - help? MrKnd94 2 6,317 Oct-14-2022, 09:57 PM
Last Post: MrKnd94

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020