<generator object =“” <genexpr =“”> at 0x7fdef86e27d8>

时间:2018-09-02 17:30:30

标签: python generator

我有以下代码python 3,它希望将输出打印到文件homology.txt中,但是对于输出文件homology.txt中的所有行,我都得到了以下典型输出

<0> 0:<generator object <genexpr> at 0x7fdef86e27d8>.

代码在下面。

#!/usr/bin/env python
import  matplotlib.pyplot as plt
import dionysus as d
import numpy as np

points =np.loadtxt('./1A1P.pts')
print("Number of Points:", len(points))
f = d.fill_rips(points, 3, 6)
#print(f)
p = d.homology_persistence(f, prime = 2)
for i, c in enumerate(p):
#print(i,c)
print(f[i], end=':',file = open('homology.txt', 'a'))
print(list([(x.element, f[x.index])] for x in c), file = open('homology.txt', 'a'))

0 个答案:

没有答案