0

my_list

x = [a, b, c, d]

config.ini

[var_list]
var01 = a1
var02 = b1
var03 = c1
var04 = d1
var05 = e1
var06 = f1

I need to write x[] to ini file and in this case, I have only 4 variables in list but I have 6 variables to keep in ini file I need to write to 'N/A' to other variables left like this

config.ini (result)

[var_list]
var01 = a
var02 = b
var03 = c
var04 = d
var05 = N/A
var06 = N/A

I have no idea how to coding in for loop or something? Thank you and sorry about bad in englist

pp7sec
  • 75
  • 4
  • 1
    Does this answer your question? [How to read and write INI file with Python3?](https://stackoverflow.com/questions/8884188/how-to-read-and-write-ini-file-with-python3) – sal Jul 15 '20 at 02:06
  • I need to use loop because In future its will behave more than 100+ variable – pp7sec Jul 15 '20 at 03:57
  • How do you define the names of the variables? Instead of a `list` I see this to be a better case for `dict` though. Or even JSON. – sal Jul 15 '20 at 04:42

0 Answers0