मुझे Python3 के साथ INI फ़ाइल को पढ़ने, लिखने और बनाने की आवश्यकता है।पायथन 3 के साथ आईएनआई फ़ाइल को कैसे पढ़ और लिखना है?
FILE.INI
default_path = "/path/name/"
default_file = "file.txt"
अजगर फ़ाइल:
# read file and if not exists
ini = iniFile('FILE.INI')
# Get and Print Config Line "default_path"
getLine = ini.default_path
# Print (string)/path/name
print getLine
# Append new line and if exists edit this line
ini.append('default_path' , 'var/shared/')
ini.append('default_message' , 'Hey! help me!!')
अद्यतन FILE.INI
default_path = "var/shared/"
default_file = "file.txt"
default_message = "Hey! help me!!"
कैसे http://docs.python.org/library/configparser.html के बारे में? –
वास्तव में, कैसे http://stackoverflow.com/a/3220891/716118 के बारे में? – voithos