'How to access all tags from a DICOM group number?

I would like to extract from a DICOM all the dicom tags with the same group number. For example, I would like to extract all tags belonging to the group 0010. I tried this, and of course it made an error:

import pydicom
ds=pydicom.dcmread('dicomfile.dcm')

print(ds[0x0008,0x0020]) # print the tag corresponding to group number 0008, and element number 0020

print(ds[0x0010,:]) # ERROR, does not print a list of all tags belonging to group 0008.

Is there a pydicom method to do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source