Welcome Anu,
I want to add to what others have written, and explain that there are many mini-languages both within python as well as near it that can use and reuse symbols and your example is outside python proper.
You said you were working in a notebook environment. The notebook is excuted by first examining cell to see if it is a special command and the percent sign in the first column is a giveaway. Whatever it does may set parameters or do other things that are not a command you can use directly within python when run alone. After such a scan, the remaining code is handed over to a python interpreter.
If you search, you may fine this:
%fs
: Allows you to use dbutils
filesystem commands. For example, to run the dbutils.fs.ls
command to list files, you can specify %fs ls
instead. For more information, see Work with files on Databricks.Welcome Anu,
I want to add to what others have written, and explain that there are many mini-languages both within python as well as near it that can use and reuse symbols and your example is outside python proper.
You said you were working in a notebook environment. The notebook is executed by first examining each cell to see if it is a special command meant before python is called on it and the percent sign in the first column is a giveaway.
Python does use the percent sign in various ways but not in the beginning of a statement, so any use there indicates something else is happening. Whatever it does may set parameters or do other things that are not a command you can use directly within python when run alone. After such a scan, the remaining code is handed over to a python interpreter.
If you search, you may find this:
%fs
: Allows you to use dbutils
filesystem commands. For example, to run the dbutils.fs.ls
command to list files, you can specify %fs ls
instead. For more information, see Work with files on Databricks.
And, in a sense, indeed this seems to be aspects of a shell command showing the files in a folder where the ${...}
is interpolated using the value of some variable. The notebook can talk to various slaved processes including whatever “shell” is being used and the python command interpreter and perhaps some for other languages. I am not familiar with Databricks. But ls *folder*
is a UNIX-style command in shells like bash that lists the contents of a folder.
%fs ls '${dataset.bookstore}/customers-json'
But as others mentioned, there are many mini-languages either considered part of python or of modules you can import. Some can be fairly complex and many make use of dollar signs and various kinds of braces. Examples include some “sort of” command strings used in some of the printing methods that allow very fine-grained specifications of exactly how you want things printed and regular expressions that allow you to specify exactly what to search for as a pattern.
Anyone can create mini-languages like this for their own purposes and the explanations may often be found outside of python itself. But not always, as some features like f-strings are part of the core now and they too use constructs embedded in text that are evaluated differently.
If you look at your learning environment, you may find other places using the familiar symbols in mysterious ways and sometimes need to find out which one is being used and locate help specific to it. Very often, it will not necessarily be in python. As one example, you may have bit of another language like SQL embedded in strings that will be sent to a database and python has no connection to the contents except to store a character string and hand it over to a function.