我试图读取1个字符和2个整数但没有成功。
C代码:
char action; int cr,cc;
printf("Enter 'c <row> <column>' to click on a block.\n");
scanf("%c %d %d",&action,&cr,&cc);
printf("You typed: %c %d %d\n",action,cr,cc);
终端输出:(示例)
Enter 'c <row> <column>' to click on a block.
c 3 3
You typed:
0 0
我在Ubuntu 16.04 LTS中用gcc(Ubuntu 5.3.1-14ubuntu2.1)5.3.1 20160413编译了它。
答案 0 :(得分:1)
答案 1 :(得分:0)
如果没有看到您的整个代码,我建议您尝试:
import numpy as np
def switchtwo(word):
ind1 = np.random.randint(1, len(word)-1)
ind2 = np.random.randint(1, len(word)-1)
l = list(word)
l[ind1], l[ind2] = l[ind2], l[ind1]
return "".join(l)
这应该有用。