#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
map<string, long int> pd;
vector<string> sb;
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin >> n;
if (n >= 1 && n <= pow(10, 5))
{
for (int i = 0; i < n; i++)
{
string name;
long int phone;
cin >> name >> phone;
pd.insert(pair<string, long int>(name, phone));
}
for (int i = 0; i < n; i++)
{
string sr;
cin >> sr;
sb.push_back(sr);
}
}
if (n >= 1 && n <= pow(10, 5))
{
map<string, long int>::iterator p = pd.begin();
vector<string>::iterator it = sb.begin();
while (p != pd.end())
{
while (it != sb.end())
{
if (p->first == *it)
{
cout << p->first <<"="<< p->second << endl;
}
else
{
cout << "Not found " << endl;
}
it++;
}
p++;
}
}
)是我的脚本中包含的一行代码,但是由于某种原因,它返回了website = input(colored('[URL] > ') 'red'
。我不明白为什么这行不通。
答案 0 :(得分:1)
首先,如果您刚刚导入了termcolor
,那么您将需要使用termcolor.colored
而不是colored
(除非您进行了from termcolor import colored
。
termcolor
库的正确语法如下:
website = input(termcolor.colored('[URL] > '), 'red')