How to get all "collections" name in one line output from "for loop" (python)
bpy_collections.
Blender uses a collection that can be accessed like a dictionary (string key) or like a list (integer index)
The name of the object in the collection is also its keys. For a collection the names of all objects in the collections can be gained quickly via the collections keys.
D.collections.keys()

(D.collections.values() is the values, and .items() the key, value pairs.
Or via list comprehension.
[c.name for c in D.collections]

Or lastly using a for loop
&gt;&gt;&gt; cols = []
&gt;&gt;&gt; for c in D.collections:
...     cols.append(c.name)
...     
&gt;&gt;&gt; cols
['Collection 1', 'Collection 1.001', 'Collection 1.002', 'Collection 1.003']

Note: could have also used cols = list() here since list is a python type. In as much as can define it as something else list = &quot;something else&quot; it's not recommended practice