i want to save magnet link in ini document.Thus,it's inevitable that i have to save "=" charactor in the file.However,python deem "=" charactor a "option to value" ,so python idle returns"configparser.DuplicateOptionError: While reading from 'history.ini' [line 3]: option 'magnet' in section '0' already exists" when i use
configparser.ConfigParser().read('history.ini')
If you have any idea to deal with this problem ,please let me know, thanks in advance.
I cannot reproduce the problem. I can save values containing
=
characters just fine:test.ini
test.py
I think the actual issue is just that you use the
magnet
key twice in the config (two lines which both start withmagnet=
).If you want to have a list of multiple magnet links you can try using something like
magnet00000=
,magnet00001=
,magnet00002=
, and so on. Or switch to JSON.