Python Forum
How i can add elements to table index of element
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How i can add elements to table index of element
I want to add an element to the list. I want this element to be on the list under the index as high as this element. If an item is already occupied, I want to add it to the next free item.
w pliku mam słowa, które zmieniam na znaki ASCII
for example input:(after converting)
table = [5,5,7,1,2,3,6]

table[0]=None table[1]=1 table[2]=2 table[3]=3 table[4]=None table[5]=5 table[6]=5 table[7]=6 table[8]=7
my code:
file = open('C:/Users/Błażej/Desktop/znaki.txt', 'r').read()
lines = file.split('\n')
table = []
for line in lines:
    for elem in lista:
    table2.insert(rozmiar, rozmiar)
you have rozmiar attribute twice on line 12,
change to once.
once does not work
it's append, not insert.
and attribute only once

Possibly Related Threads…
Thread Author Replies Views Last Post
  pandas pivot table: How to find count for each group in Index and Column JaneTan 0 85 Yesterday, 04:35 AM
Last Post: JaneTan
  myList.insert(index, element) question ChrisF 1 313 Aug-27-2021, 03:49 PM
Last Post: bowlofred
  Sorting Elements via parameters pointing to those elements. rpalmer 3 876 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  Adding List Element if Second part of the List Elements are the Same quest_ 3 843 Nov-25-2020, 04:33 PM
Last Post: bowlofred
  How to get index of minimum element between 3 & 8 in list Mekala 2 926 Nov-10-2020, 12:56 PM
Last Post: DeaD_EyE
  Fetch Oracle DB rows & print it in HTML file with table's col headers in table format tssr_2001 1 1,244 Sep-04-2020, 01:39 PM
Last Post: ibreeden
  MYSQL how to assign a table for each user in my username table database? YoshikageKira 1 1,396 Dec-26-2019, 05:57 AM
Last Post: buran
  change array elements dependent on index SchroedingersLion 1 957 Nov-22-2019, 06:25 AM
Last Post: scidam
  Select a part of an element of a list with Index BollerwagenIng 0 994 Aug-09-2019, 09:27 AM
Last Post: BollerwagenIng
  Unable to locate element no such element gahhon 6 2,052 Feb-18-2019, 02:09 PM
Last Post: gahhon

Forum Jump:

User Panel Messages

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