# Group list in FISH and Python

**URL:** <https://forum.itascainternational.com/t/group-list-in-fish-and-python/802>\
**Category:** Uncategorized\
**Created:** [October 28, 2022, 7:31pm UTC](https://forum.itascainternational.com/t/group-list-in-fish-and-python/802 "2022-10-28T19:31:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jmswdmn](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jmswdmn](https://forum.itascainternational.com/u/jmswdmn)\
**Post date:** [October 29, 2022, 10:09am UTC](https://forum.itascainternational.com/t/group-list-in-fish-and-python/802/2 "2022-10-29T10:09:31Z")

</div>

You can export a list of the group for each zone in the model using the [file.all](http://docs.itascacg.com/flac3d700/common/fish/doc/fish_manual/fish_fish/file_utilities/fish_file.all.html?highlight=file%20all) command as described in forum post [here](https://forum.itascainternational.com/t/top-tips-and-hidden-gems/202/6). e.g.

```auto
[file.all("test.txt","text") = zone.group(::zone.list)]

```

However, you might also need to consider the slots of your groups, and therefore might want an output file with more structure, which you can then manipulate? If so, something like the following might get you started in python:

```auto
import itasca as it
import json
it.command("python-reset-state false")
it.command("""
model restore "test"
""")

output_dict = {}

for z in it.zone.list():
        slot_def = z.group()
        slot_example_1 = z.group("Example 1")
        slot_example_2 = z.group("Example 2")
        output_dict[z.id()] = {
            "slot = default" : slot_def,
            "slot = 1" : slot_example_1,
            "slot = 2" : slot_example_2
            }
    
output_file = "test.json"
with open(output_file, 'w') as fout:
    json.dump(output_dict, fout)

```

---

_[View the full topic](https://forum.itascainternational.com/t/group-list-in-fish-and-python/802)._
