Below is the captured text of a session at an interactive python prompt.
I've tidied up some wrapped lines. pixel_array requires the Numpy library
Assumed is started in the 'testfiles' directory
Note: "<BLANKLINE>" is inserted here to match doctest testing of this code.
If used in interactive session, you will simply see a blank line at those places.
>>> import pydicom
>>> ct = pydicom.read_file("CT_small.dcm")
>>> ct.remove_private_tags()
>>> ct.dir("image")
['ImageComments', 'ImageOrientationPatient', 'ImagePositionPatient', 'ImageType']
>>> ct.ImageType
['ORIGINAL', 'PRIMARY', 'AXIAL']
>>> ct.Rows, ct.Columns
(128, 128)
>>> len(ct.PixelData)
32768
>>> ct.pixel_array
array([[175, 180, 166, ..., 203, 207, 216],
       [186, 183, 157, ..., 181, 190, 239],
       [184, 180, 171, ..., 152, 164, 235],
       ..., 
       [906, 910, 923, ..., 922, 929, 927],
       [914, 954, 938, ..., 942, 925, 905],
       [959, 955, 916, ..., 911, 904, 909]], dtype=int16)
>>> plan = pydicom.read_file("rtplan.dcm")
>>> len(plan.BeamSequence)
1
>>> beam = plan.BeamSequence[0]
>>> len(beam.ControlPointSequence)
2
>>> cp0, cp1 = beam.ControlPointSequence
>>> cp0.GantryAngle
"0.0"
>>> cp0.GantryAngle = '90.0' # use string for Decimal (VR of DS)
>>> bldps0 = cp0.BeamLimitingDevicePositionSequence[0]
>>> print(bldps0)
(300a, 00b8) RT Beam Limiting Device Type        CS: 'X'
(300a, 011c) Leaf/Jaw Positions                  DS: ['-100.00000000000', '100.000000000000']
>>> # NOTE: the <BLANKLINE> lines below are for running this through doctest
>>> help(plan.save_as)
Help on method save_as in module pydicom.dataset:
<BLANKLINE>
save_as(self, filename, write_like_original=True) method of pydicom.dataset.FileDataset instance
    Write the dataset to a file.
<BLANKLINE>
    Parameters
    ----------
    filename : str
        Name of file to save new DICOM file to.
    write_like_original : boolean
        If True (default), preserves the following information from
        the dataset:
        -preamble -- if no preamble in read file, than not used here
        -hasFileMeta -- if writer did not do file meta information,
            then don't write here either
        -seq.is_undefined_length -- if original had delimiters, write them now too,
            instead of the more sensible length characters
        - is_undefined_length_sequence_item -- for datasets that belong to a
            sequence, write the undefined length delimiters if that is
            what the original had.
        If False, produces a "nicer" DICOM file for other readers,
            where all lengths are explicit.
<BLANKLINE>
    See Also
    --------
    pydicom.filewriter.write_file
        Write a DICOM file from a FileDataset instance.
<BLANKLINE>
    Notes
    -----
    Set dataset.preamble if you want something other than 128 0-bytes.
    If the dataset was read from an existing dicom file, then its preamble
    was stored at read time. It is up to the user to ensure the preamble is still
    correct for its purposes.
<BLANKLINE>
    If there is no Transfer Syntax tag in the dataset, then set
    dataset.is_implicit_VR and dataset.is_little_endian
    to determine the transfer syntax used to write the file.
<BLANKLINE>
>>> plan.save_as("rtplan_gantry90.dcm")
>>> plan_g90 = pydicom.read_file("rtplan_gantry90.dcm")
>>> plan_g90.BeamSequence[0].ControlPointSequence[0].GantryAngle
"90.0"
>>>
