I tried to store array values in python but after inserting values I close the IDE and open it prints the array values null. How can we store dynamic array values permanently in python it's like load and write values from a file.......
            Asked
            
        
        
            Active
            
        
            Viewed 166 times
        
    -2
            
            
        - 
                    write a file and don't use the IDE to store data – 0TTT0 Oct 21 '17 at 16:07
- 
                    What you did may be obvious to you, but you need to be explicit with us. *How* did you try to store them? If your question is how to write to and read from a file, it has surely been asked before. – Reti43 Oct 21 '17 at 16:08
- 
                    how can we permanently store array values in python??? – Arun Das Oct 21 '17 at 16:12
- 
                    There are many options for writing something to a file, but the cleanest or most appropriate depends on what kind of values you have. Is it an numpy array or list? Are your values numbers, strings or objects? – Reti43 Oct 21 '17 at 16:34
2 Answers
0
            
            
        You could use
- json
- pickle
for permanent storage.
if STORAGEFILE EXISTS:
  Var = STORAGEFILE_CONTENT
else:
  Var = currentVal
ON_EXIT:
  Update Var to STORAGEFILE
 
    
    
        Fuji Komalan
        
- 1,979
- 16
- 25
- 
                    it's a dynamic array so i need to update it every time also it's loads first when programme start – Arun Das Oct 21 '17 at 16:15
- 
                    @ArunDas refer this link for pickle http://www.diveintopython3.net/serializing.html – Fuji Komalan Oct 21 '17 at 16:33
0
            
            
        The easiest way is to write the array values to a txt-file. Then you can close your IDE and later open it and get the array from the txt-file.
 
    
    
        PederBG
        
- 118
- 1
- 2
- 11
