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
  Sorting Elements via parameters pointing to those elements. rpalmer 3 651 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  Adding List Element if Second part of the List Elements are the Same quest_ 3 635 Nov-25-2020, 04:33 PM
Last Post: bowlofred
  How to get index of minimum element between 3 & 8 in list Mekala 2 794 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 972 Sep-04-2020, 01:39 PM
Last Post: ibreeden
  Mysql CREATE TABLE IF NOT EXISTS dynamic table name nisusavi 0 677 Apr-29-2020, 06:45 PM
Last Post: nisusavi
  MYSQL how to assign a table for each user in my username table database? YoshikageKira 1 1,238 Dec-26-2019, 05:57 AM
Last Post: buran
  change array elements dependent on index SchroedingersLion 1 781 Nov-22-2019, 06:25 AM
Last Post: scidam
  Select a part of an element of a list with Index BollerwagenIng 0 857 Aug-09-2019, 09:27 AM
Last Post: BollerwagenIng
  Unable to locate element no such element gahhon 6 1,750 Feb-18-2019, 02:09 PM
Last Post: gahhon
  Change single element in 2D list changes every 1D element AceScottie 9 6,287 Nov-13-2017, 07:05 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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