我想在终端中获取Python函数的结果。
我尝试运行命令:
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
int score;
string eAnswer1, eAnswer2, aEasy1, aEasy2;
aEasy1 = "source code";
aEasy2 = "language translator";
cout << "1st Question: It is a well-written set of instructions and statements to develop a program. Answer: ";
cin.ignore();
getline(cin, eAnswer1);
if (eAnswer1 == aEasy1) {
score = score + 1;
}
cout << "2nd Question: Source code must be translated to machine language using a? Answer: ";
cin.ignore();
getline(cin, eAnswer2);
if (eAnswer2 == aEasy2) {
score = score + 1;
}
cout << score << endl;
return 0;
}
我希望看到的输出类似于:$ python3 -m uuid uuid.uuid4().hex
不幸的是我得到了错误:
'78cbf0fadaa34ff7ac3f7b965965e207'
答案 0 :(得分:6)
你很近。
-c
,而不是-m
。import uuid
才能使用它。print()
来实际看到一些输出。
$ python3 -c "import uuid; print(uuid.uuid4().hex)"