pip install pyyaml
import yaml
result = []
for i in range(5):
a= {'merchant': '1514', 'str_attr': '1514', 'url': 'http://product.resources.deepd49ad6f148eb.png'}
result.append(a)
yaml.dump(result, open("mgxx_ali.yaml", "w"))
- {merchant: '1514', str_attr: '1514', url: http://product.resources.deepd49ad6f148eb.png'}
- {merchant: '1514', str_attr: '1514', url: http://product.resources.deepd49ad6f148eb.png'}
- {merchant: '1514', str_attr: '1514', url: http://product.resources.deepd49ad6f148eb.png'}
- {merchant: '1514', str_attr: '1514', url: http://product.resources.deepd49ad6f148eb.png'}
- {merchant: '1514', str_attr: '1514', url: http://product.resources.deepd49ad6f148eb.png'}
网友评论