如何在Python中的多行中获取多个输入

发布于 2025-01-13 17:07:47 字数 245 浏览 2 评论 0原文

我必须在多行中接受多个输入,

例如

n=int(input())

我必须在 n 行中接受 n 个输入,并且每行接受多个输入,

if n=5
then I have to take 5 input in 5  line
a=[1,2,3]
b=[1,2,3]
c=[1,2,3]
d=[1,2,3]
e=[1,2,3]

这只是一个例子。

I have to take multiple input in multiple lines

for example

n=int(input())

I have to take n input in n line and each line take multiple input

if n=5
then I have to take 5 input in 5  line
a=[1,2,3]
b=[1,2,3]
c=[1,2,3]
d=[1,2,3]
e=[1,2,3]

like this is just an example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执妄 2025-01-20 17:07:47

这将是你所需要的......

n = int(input())
for i in range(n):
    exec(input())
print(a, b, c, d, e)

This would be what you need...

n = int(input())
for i in range(n):
    exec(input())
print(a, b, c, d, e)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文