简体   繁体   English

如何解决错误:“*后的值必须是可迭代的,而不是int”,如下图所示

[英]how to solve the error: "Value after * must be an iterable, not int" as shown in the image below

如何解决错误:“* 后的值必须是可迭代的,而不是 int”,如下图所示 在此处输入图像描述

如果想给出多个参数,Join 需要一个参数,您可以将其作为列表或元组提供。

You're trying to unpack an... integer :)您正在尝试解压缩...整数:)

The asterisk operator in python is used to unpack a list, for example if you have some case like: python 中的星号运算符用于解包列表,例如,如果您有以下情况:

full_name = ["Jimi", "Hendrix"]
print("My name is", *full_name)

So in your case you passed an integer, while the operator expects an iterable such as list for example.因此,在您的情况下,您传递了一个整数,而运算符需要一个可迭代的对象,例如列表。

I think I get what you're trying to accomplish l.我想我明白了你想要完成的事情。 You are trying to put ?你想把? for each field in valeur_1[0] (I know some french 🙂).对于valeur_1[0]中的每个字段(我知道一些法语🙂)。

In that case you should use this在这种情况下,你应该使用这个

markers = ",".join([ "?" for _ in len(valeur_1[0]) ])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决这个“TypeError: print() argument after * must be an iterable, not int”? - How to solve this “TypeError: print() argument after * must be an iterable, not int”? Python 线程模块错误参数 * 必须是可迭代的,而不是 int - Python Threading module Error argument after * must be an iterable, not int * 之后的 Add() 参数必须是可迭代的,而不是 int Pygame - Add() argument after * must be an iterable, not int Pygame “* 之后的 add() 参数必须是可迭代的,而不是 int” - “add() argument after * must be an iterable, not int” Python 线程错误 - 必须是可迭代的,而不是 int - Python threading error - must be an iterable, not int 如何解决 TypeError: 'int' object is not iterable? - How to solve TypeError: 'int' object is not iterable? 如下所示,如何使用opencv保存图像? - How to save image using opencv after done this code as shown below? 在下面的代码中,我收到一个错误,因为“第一个参数必须是 pandas 对象的可迭代对象”。 我怎样才能解决这个问题? - In the code below, I get an error as "first argument must be an iterable of pandas objects". How can I fix this? TypeError:在 * 之后键入 object 参数必须是可迭代的,而不是 int - TypeError: type object argument after * must be an iterable, not int 如何解决TypeError:在我的GTIN代码中无法迭代“ int”对象 - How to solve TypeError: 'int' object is not iterable in my GTIN code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM