[x for x in<>而<>]? [英] [x for x in <> while <>]?

查看:83
本文介绍了[x for x in<>而<>]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我经常需要一个表格的列表或迭代器

[x for x in< while<>]

并且没有像这样的一个。

可能还有另一种简短的方法来编写它(不是作为循环)。那是

吗?

谢谢

It seems that I rather frequently need a list or iterator of the form
[x for x in <while <>]
And there is no one like this.
May be there is another short way to write it (not as a loop). Is
there?
Thanks

推荐答案



" ; urikaluzhny" < uk ******* @ nds.com写了留言

新闻:f8 *********************** *********** @ w7g2000h sa.googlegroups.com ...

|似乎我经常需要一个表单的列表或迭代器

| [x for x in< while<>]


我可以想出两种解释方法。


|并且没有人喜欢这样。

|可能还有另一种简短的方法来编写它(不是作为循环)。是

|那里?


使用循环写一个你的意思的例子可以使上面的

更清晰。


tjr


"urikaluzhny" <uk*******@nds.comwrote in message
news:f8**********************************@w7g2000h sa.googlegroups.com...
| It seems that I rather frequently need a list or iterator of the form
| [x for x in <while <>]

I can think of two ways to interpret that.

| And there is no one like this.
| May be there is another short way to write it (not as a loop). Is
| there?

Using loops to write an example of what you mean would make the above
clearer.

tjr


urikaluzhnyaécrit:
urikaluzhny a écrit :

似乎我经常需要列表或形式的迭代器

[x for x in< while<>]

并且没有这样的人。

May是否有另一种简短的方法来写它(不是作为一个循环)。那是

吗?
It seems that I rather frequently need a list or iterator of the form
[x for x in <while <>]
And there is no one like this.
May be there is another short way to write it (not as a loop). Is
there?



答案很可能在itertools模块中。

The answer is very probably in the itertools module.


urikaluzhny< uk * ****** @nds.comwrites:
urikaluzhny <uk*******@nds.comwrites:

似乎我经常需要一个表格的列表或迭代器

[ x for x in< while<>]

并且没有这样的人。

可能还有另一种简短的方法来写它(不是作为一个环)。在那儿?
It seems that I rather frequently need a list or iterator of the form
[x for x in <while <>]
And there is no one like this.
May be there is another short way to write it (not as a loop). Is there?



itertools.takewhile(condition,seq)

itertools.takewhile(condition, seq)


这篇关于[x for x in&lt;&gt;而&lt;&gt;]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆