我正在使用qt,正在尝试使用该QInputDialog::getText()功能从用户那里获取输入,根据文档,该功能的定义为:
QString QInputDialog::getText(QWidget * parent, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone)
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
bool ok=0;
newAddress = QInputDialog::getText(0,"Enter an Address to Validate",
"Adress: comma separated (e.g Address line 1, Address line 2, City, Postal Code)"
,&ok);
Run Code Online (Sandbox Code Playgroud)
但我得到了错误:
error: no matching function for call to 'QInputDialog::getText(int, const char [29], const char …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 python 中创建内置的 map() 函数。这是我的尝试:
def mapper(func, *sequences):
if len(sequences) > 1:
while True:
list.append(func(sequences[0][0],sequences[0][0],))
return list
return list
Run Code Online (Sandbox Code Playgroud)
但我真的很困惑,因为如果用户给出例如 100 个参数,我该如何处理这些参数?