iterable

    1热度

    1回答

    我的二进制搜索树不能管理多于3个节点或能够显示它们。我需要迭代地添加它们,并在作业中使用堆栈显示它们,但如果它具有多于3个元素,则无法显示BST。 public boolean add(E b) { //if tree is empty if (root == null) { root = new Node(); root.setValue(b);

    0热度

    1回答

    from collections.abc import Sequence class Map(Sequence): """ Represents a map for a floor as a matrix """ def __init__(self, matrix): """ Takes a map as a matrix """ self.mat

    0热度

    1回答

    我已经搜索尽可能我看,我努力寻找这个问题的答案..我有一个Iterable对象,我想修改它中的每个项目(我不想添加到它)具有新的价值。我试过 for (T e : list) { e = a.get(index); System.out.println(e); index--; } 修改它,但显然没有工作,因为它是一个foreach循环。有人能告诉我我在做什么

    0热度

    1回答

    当我试图扫描/搜索的文件,它抛出: IndexError: list index out of range on the line "list = self.scanFolder(path[t])" 这是一个对象,并有一些方法/函数这里没有显示,因为它们是不相关的这段代码。 def scanFolder(self, path): try: return os.listdir(

    1热度

    1回答

    为什么这是真的: from collections import Iterable import tensorflow as tf v = tf.Variable(1.0) print(isinstance(v, Iterable)) True 而这 iter(v) 给 TypeError: 'Variable' object is not iterable.

    3热度

    2回答

    我想了解python中的迭代器的概念,并在Python 3.5.2中试过。 x = list(range(1000)) # size of x is 9112 bytes y = iter(x) # size of y is 56 bytes del x x = list(y) # size of x is again 9112 bytes 迭代器如何存储有关它必须生成的序列

    -2热度

    1回答

    覆盖的方法想要返回Iterable<T>,但在我有Iterable<String>的方法中。我如何从Iterable<String>甚至Set<String>返回Iterable<T>? 代码: @Override public Iterable<T> getAll() { Set<String> set = getCache().keySet(); Iterable<Str

    4热度

    3回答

    在下面的示例代码中,为什么Iterable [String] test1在映射之后产生Set? val foo = Map("a" -> 1, "b" -> 1) val test1: Iterable[String] = foo.keys val test2: Iterator[String] = foo.keys.toIterator println(test1.map(foo).si

    1热度

    1回答

    这是我第一个关于堆栈溢出的问题,它可能有点笨重,因为我学习了绳索 - 提示或问题格式化欢迎光临指针! 我很新的蟒蛇,并具有几乎相同下面的一个问题: how to split one column into many columns and count the frequency 对于我的数据,我有两列,“记录”和“页”,其中记录器是一个非空对象字符串格式的IP地址列,page是一个随机的1-10非

    -2热度

    2回答

    是否有与Python的all()内置函数等价的函数? 换句话说:存在一个C++ 11函数,当迭代器的所有元素都满足一定条件时返回true,否则返回false?