The square brackets indicate that these arguments are optional. You can leave them out.
So, in this case you are only required to pass the csvfile
argument to csv.DictReader
. If you would pass a second parameter, it would be interpreted as the fieldnames
arguments. The third would be restkey
, etc.
If you only want to specify e.g. cvsfile
and dialect
, then you’ll have to name the keyword argument explicitly, like so:
csv.DictReader(file('test.csv'), dialect="excel_tab")
For more on keyword arguments, see section 4.7.2 of the tutorial at python.org.