我不断收到错误消息“期望缩进块”
18676 error Exit status 1
18677 error Failed at the grpc@1.10.1 install script.
18677 error This is probably not a problem with npm. There is likely additional logging output above.
18678 verbose exit [ 1, true ]
答案 0 :(得分:0)
在if语句中缩进代码块应该解决它。
month = int(input('Please enter a month in numeric form: '))
day = int(input('Please enter a day in numeric form: '))
year = int(input('Please enter a two-digit year in numeric form: '))
if month * day == year:
print ('The date is magic!')
else:
print ('The date is not magic.')
答案 1 :(得分:0)
在Python中,缩进至关重要。在每个#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
int clients_fd[100];
int cnt = 0;
int main() {
int serv_sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in serv_addr;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(8080);
serv_addr.sin_family = AF_INET;
bind(serv_sock,(struct sockaddr*)&serv_addr,sizeof(serv_addr));
listen(serv_sock, 100);
while (cnt < 100) {
int client_sock = accept(serv_sock, NULL, NULL);
clients_fd[cnt] = client_sock;
printf("cnt is %d", cnt);
cnt++;
}
return 0;
}
之后,您必须至少缩进下一行,以便解释器理解该行属于该块。
:
我建议您收集有关how indents work in Python的更多信息