我正在尝试用perl输出一个文件。open(my $out, ">", "output.html") or die "Can't open output.txt: $!";它工作得很完美。如果我把它改成这样
open(my $out, ">", "c:\somedirectory\output.html") or die "Can't open output.txt: $!
F是得到第三个元素的函数,而不是作为正规Fibonacci序列的a+b。使用采取函数(如下图所示)来测试它。TypeError: 'generator' object is not subscriptable" take(5, fib(0, 1, lambda x, y: x - y))[0, 1, -1, 2, -3]def take(n, iterable): if n <= 0:
return x