示例:
dic = {'a': 'b', 'c': 'd'}
for x, y in dic:
print(x,y)
理想情况下会返回
a b
但它会引发错误。那么,有没有替代方法:
for x in dic:
y = dic[x]
答案 0 :(得分:1)
试试这个:
#include<stdio.h>
#include <stdlib.h>
int main()
{
int i;
int j;
int mat[31][200];
FILE *file;
file=fopen("uid.txt", "r");
for(i = 0; i < 31; i++)
{
for(j = 0; j < 200; j++)
{
if (!fscanf(file, "%d", &mat[i][j]))
break;
}
}
fclose(file);
int col,value,row;
printf("enter row");
scanf("%d",&row);
printf("enter col");
scanf("%d",&col);
printf("enter changed value");
scanf("%d",&value);
mat[row][col]=value;
file=fopen("uid.txt", "w+");
for(i = 0; i < 31; i++)
{
for(j = 0; j < 200; j++)
{
fprintf(file,"%d ", mat[i][j]);
}
fprintf(file,"\n");
}
fclose(file);
}