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
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
it can be used without open as a file
import toml
data = toml.load("./config.toml")
print(data["first"]["name"])
import toml
with open("file.toml", "r") as f:
data = toml.load(f)
print(data["first"]["name"])
© 2022 - 2024 — McMap. All rights reserved.