我有一个字典清单。这是列表的一个元素: mylist [1]给出以下判词。
"ServerlessRestApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Description":"This is a placeholder for the description of this web api",
"ApiKeySourceType":"HEADER",
"Body": {
"info": {
"version": "1.0",
"title": {
"Ref": "AWS::StackName"
}
},
"paths": {
"/list/tables": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableList.Arn}/invocations"
}
},
"security": [
{
"api_key": []
}
],
"responses": {}
}
},
"/list/columns/{tableid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetColumnList.Arn}/invocations"
}
},
"responses": {}
}
},
"datagw/general/table/get/{tableid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableResponse.Arn}/invocations"
}
},
"responses": {}
}
},
"/": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Get.Arn}/invocations"
}
},
"responses": {}
}
},
"/tables/{tableid}/{columnid}": {
"get": {
"x-amazon-apigateway-integration": {
"httpMethod": "POST",
"type": "aws_proxy",
"uri": {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetTableBasic.Arn}/invocations"
}
},
"responses": {}
}
},
"securityDefinitions": {
"type": "api_key",
"name": "x-api-key",
"in": "header"
}
},
"swagger": "2.0"
}
}
},
我在以下非常简化的for循环中创建每个字典:
{'bitrate': None,
'channels': None,
'duration': 107.927,
'filename': 'CANCION DE POKEMON GO SONIDO DE INICIO POKEMON GO(SLM)',
'filesize': 19642323,
'samplerate': None}
我已经尝试过了
mylist=[]
for loop
dict=create the dictionary
mylist.append(dict)
但是它给出了一个很长的错误。
如何将我的列表保存到.mat文件?预先感谢。
答案 0 :(得分:0)
class A
{
public:
A& operator=(A&& other){/*...*/};
};
int main()
{
A a;
A b;
a = b;
return 0;
}
为此提供了一个简单的帮助程序功能scipy
。
scipy.io.savemat
请注意,import scipy # scipy is installed
# ... generate mylist
fname = "my_filename" # arbitrary filename
scipy.io.savemat(fname, {"Data": mylist})
需要一个字典,因此,如果仅通过制作示例中所示的一键值对字典,就必须将savemat
改成字典。