将 <type 'google.protobuf.pyext._message.RepeatedScalarContainer'> 转换为列表

Vin*_*dey 11 python google-cloud-platform

我正在尝试列出 dataproc 集群以获取工作节点名称。代码返回的数据类型是,我想将其转换为列表

for cluster in dataproc_cluster_client.list_clusters(project_id, region):
    if cluster.cluster_name == 'test':
        print(type(cluster.config.worker_config.instance_names))
        print(type(cluster.config.master_config.instance_names))
Run Code Online (Sandbox Code Playgroud)

小智 12

list(cluster.config.worker_config.instance_names) 转换为 Python 列表