Learn TOML in 10 Minutes (Tutorial)
2024 ж. 13 Мам.
21 418 Рет қаралды
In this tutorial we're going to be learning what TOML is, and how it works. We will be using it in Python, but it works for practically any programming language you can think off.
TOML docs: toml.io/en/
▶ Become job-ready with Python:
www.indently.io
▶ Follow me on Instagram:
/ indentlyreels
00:00 What is TOML?
00:54 Creating a TOML file
02:03 Loading TOML
04:16 Learning TOML
09:28 Timestamps
10:30 Conclusion
This is a pretty good introduction to TOML. But I need to point out that single and double quotes in TOML work differently. Single quotes are used to write literal strings, which work like a strict version of Python's raw strings. Good for things like Windows paths. For that reason, you don't need to be consistent. Use what is best for your text.
And I made a YAML tutorial for monday :)
Fascinating 🤩🤩
Great tutorial.
Thank you for this very interesting video!
When it comes to parsing, is it faster than json?
Awesome 👍
Thank you Frederico.I am using the latest version of VSC but not getting the the autocomplete/Intellisense or what you call the Copilot code completion. I did install the Intellisense (PyLance) extension recommended inside VSC, but I gloss over it as if it has been talked about elsewhere?do not get the same level of autocomplete and zero autocompletion inside the toml file. I suspect I need to "install" Copilot. Did I miss a video on that, as you seem to glass over it here, indicating maybe that is has been covered elsewhere? Anyway, great tut so thank you once again.
If you want code prediction, you will need to install copilot as an add on :)
cool thank you!
hi, would you tell me what's the theme of your ide
Load the TOML then modify a value in it how do we do that effectively?
Its great to use toml but can't i just use normal json files and import those directly as dict. If there is no functional difference, logically with respect to python both are exactly same. I believe it is a matter of personal choise here.
It’s like ini format on steroids.
true
It's an ini file, structured as a good progammer would have done it 25 years ago.
thanks really thorough guide now i wonder should i use toml instead of yamls
I personally enjoyed TOML more, but I don't know if TOML is lacking in anything compared to YAML since I've used neither of them in big projects.
Is it possible to manipulate the toml file with python code?
Yeah, pretty much it converts dicts to TOML and you can do the same thing backwards.
But is this better than Yaml file?
Don't really know how companies decide, but I prefer TOML for I found it FAAARR more simple. To the point that I could make this video in 10 minutes vs the YAML video in 17.
Yaml is easier to read, but far more complex. I would use TOML and split it into multiple files, so it's easier to read.
YAML fans say YAML is much easier to read than TOML. In this case I can give you these simple tips: 1. Indend the text in TOML This will improve readability a lot. 2. Split TOML into multiple files. If you do this readability in TOML is far better than before and not that much behind YAML anymore. In case of indending text you have even more possibilities as with YAML.
function annotations are so useless