pythonarraysedid

Python: Dump whole list in a variable


I have this code:

def write_extension(self):

    extension = []
    dtd = ""
    if extension == []:
            extension = extension.extend(self.edids[]  (Thanks to Howardyan for making it clearer for me)

    print(extension)

I want to write the complete array in the new array extension but i dont know how. Is there an easy way doing this? Later on (when extension is not empty) i just want to add the array to the end of the extension array.

To Make it clear. Now i have this:

And i want to have this after i added all arrays to extension

extension = [123, 456, 789]


Solution

  • extension's type is str. cannot add with a list. you need do this:

    def write_extension(self):
    
        extension = []
        dtd = ""
        if extension == []:
                extension = extension.extend(self.edids[:])
                print(extension)