Local cell and global edges

Hello everybody,

I would like do to this:

for cell in cells(mesh):
    print("    cell : " + repr(cell.index()+1))
    dfacetsi = dict((faceti.index(), faceti.entities(0)) for faceti in facets(cell))
    for faceti in range(len(dfacetsi)):
        key = dfacetsi.keys()[faceti]
        print("   " + repr(key+1) + " : " + str(dfacetsi[key]+1))

But unfortanetly this doesn’t seems to be supported anymore. First k.keys gives a object not a list in python 3 and also facets is not up to date anymore.
Can somebody please give me a hint what i can do now?
Thank you!

Greetings

This is not how you should access keys in a dictionary. You should loop over the keys:

from fenics import *

mesh = UnitSquareMesh(1,1)

for cell in cells(mesh):
    print("    cell : " + repr(cell.index()+1))
    dfacetsi = dict((faceti.index(), faceti.entities(0)) for faceti in facets(cell))
    for key in dfacetsi.keys():
        print("   " + repr(key+1) + " : " + str(dfacetsi[key]+1))

Thank you very much dokken!
You should write a book about Fenics ;). I would definitely buy it.