正解:C
The script should be completed with the code that opens a file in write mode for each device and writes the configuration into it in JSON format. Option C is correct because it uses a context manager to open a file named after the hostname variable with a .json extension. It then writes the device variable, which presumably contains the device configuration, into this file using json.dump(), ensuring the data is in JSON format.
References:
* Implementing and Operating Cisco Service Provider Network Core Technologies (SPCOR) course material
* Python documentation on file handling and the json module
* Cisco learning resources on network automation and scripting