Dolfin syntaxe error

Hello there, I’m seeing the documentation from this dolfin documentation website: https://fenicsproject.org/olddocs/dolfin/1.4.0/python/demo/documented/built-in_meshes/python/documentation.html
And when I was trying to do build in meshes part, there are having a lot of syntax troubles. The code:

from dolfin import *

mesh = UnitIntervalMesh(10)
print ("Plotting a UnitIntervalMesh")
plot(mesh, title="Unit interval")

mesh = UnitSquareMesh(10, 10)
print ("Plotting a UnitSquareMesh")
plot(mesh, title="Unit square")

mesh = UnitSquareMesh(10, 10, "left")
print ("Plotting a UnitSquareMesh")
plot(mesh, title="Unit square (left)")

mesh = UnitSquareMesh(10, 10, "crossed")
print ("Plotting a UnitSquareMesh")
plot(mesh, title="Unit square (crossed)")

mesh = UnitSquareMesh(10, 10, "right/left")
print ("Plotting a UnitSquareMesh")
plot(mesh, title="Unit square (right/left)")

mesh = RectangleMesh(0.0, 0.0, 10.0, 4.0, 10, 10)
print ("Plotting a RectangleMesh")
plot(mesh, title="Rectangle")

mesh = RectangleMesh(-3.0, 2.0, 7.0, 6.0, 10, 10, "right/left")
print ("Plotting a RectangleMesh")
plot(mesh, title="Rectangle (right/left)")

if has_cgal():
    mesh = CircleMesh(Point(0.0, 0.0), 1.0, 0.2)
    print ("Plotting a CircleMesh")
    plot(mesh, title="Circle (unstructured)")

    mesh = EllipseMesh(Point(0.0, 0.0), [3.0, 1.0], 0.2)
    print ("Plotting an EllipseMesh")
    plot(mesh, title="Ellipse mesh (unstructured)")

    mesh = SphereMesh(Point(0.0, 0.0, 0.0), 1.0, 0.2)
    print ("Plotting a SphereMesh")
    plot(mesh, title="Sphere mesh (unstructured)")

    mesh = EllipsoidMesh(Point(0.0, 0.0, 0.0), [3.0, 1.0, 2.0], 0.2)
    print ("Plotting an EllipsoidMesh")
    plot(mesh, title="Ellipsoid mesh (unstructured)")

mesh = UnitCubeMesh(10, 10, 10)
print ("Plotting a UnitCubeMesh")
plot(mesh, title="Unit cube")

mesh = BoxMesh(0.0, 0.0, 0.0, 10.0, 4.0, 2.0, 10, 10, 10)
print ("Plotting a BoxMesh")
plot(mesh, title="Box")

interactive()
´´´
The error I've got:
Type "help", "copyright", "credits" or "license" for more information.
>>> /usr/bin/python3 "/home/jandui/Documents/MATH code/testes_3/demo_built-in.py"
  File "<stdin>", line 1
    /usr/bin/python3 "/home/jandui/Documents/MATH code/testes_3/demo_built-in.py"
    ^
SyntaxError: invalid syntax

And what is that of if_has? This is from c++, right?
Also, why there is that interactive()? Does Dolfin plot the graphs, or should I import Matplotlib?

You are looking at outdated demos (v1.4.0). See
https://fenicsproject.org/olddocs/dolfin/latest/python/demos/built-in-meshes/demo_built-in-meshes.py.html?highlight=built%20meshes

Instead of

Please note

Thank you; I will try to switch to Dolfinx. However, I’m having a lot of trouble understanding the syntax, even after reading the documentation (understanding how to build meshes, formulate the weak form in Fenicsx,…). Is there a book on Dolfinx that explains the details, similar to the Fenics book? I found the Fenics book very helpful.

I’ve made several tutorial for DOLFINx:
https://jorgensd.github.io/dolfinx-tutorial/
https://jsdokken.com/FEniCS23-tutorial/README.html
https://jsdokken.com/dolfinx_docs/meshes.html
FEniCSx Tutorial @ FEniCS 2022 — FEniCS 22 tutorial (slightly outdated).

Ok, thanks, it will help me a lot.