[root@centos5 library]# python testfuture.py
{'api_interface': 'eth0', 'time': 3, 'storage_interface': 'eth2', 'control_ip': ['192.168.160.73', '192.168.160.75', '10.10.1.73', '10.10.1.75'], 'port': 3214, 'network_interface': 'eth3'}
[root@centos5 library]#
[root@centos5 library]# vi testfuture.py
[root@centos5 library]# python testfuture.py
{'api_interface': 'eth0', 'time': 3, 'storage_interface': 'eth2', 'control_ip': ['192.168.160.73', '192.168.160.75', '10.10.1.73', '10.10.1.75'], 'port': 3214, 'network_interface': 'eth3'}
[root@centos5 library]# cat testfuture.py
#coding=utf-8
import yaml
f = open('demo4.yaml')
print type(f)
#导入
x = yaml.load(f)
print type(x)
print x
[root@centos5 library]#