How to load toml file into a python file that my code
python file:
import toml
toml.get("first").name
toml file :
[first]
name = "Mark Wasfy"
age = 22
[second]
name = "john micheal"
age = 25
CodePudding user response:
it can be used without open as a file
import toml
data = toml.load("./config.toml")
print(data["first"]["name"])
CodePudding user response:
import toml
with open("file.toml", "r") as f:
data = toml.load(f)
print(data["first"]["name"])