Problem with variation formula

I think you mistyped (both syntax as well as the actual boundary) the boundary conditions here. It should be:

bord1 = CompiledSubDomain("near(x[0], 0)")
bord2 = CompiledSubDomain("near(x[0], 1)")

A complete code, would thus be

from dolfin import *
import matplotlib.pyplot as plt

# Parameters of the problem
nx       = 10
epsilon  = 0.1
lmbda    = 1
f        = 1

# Create mesh and define function space
mesh = UnitIntervalMesh(nx)
Q = FunctionSpace(mesh, 'P', 1)

# Define variational problem
u = TrialFunction(Q)
v = TestFunction(Q)
w = Function(Q)
bord1 = CompiledSubDomain("near(x[0], 0)")
bord2 = CompiledSubDomain("near(x[0], 1)")

bcs = [
    DirichletBC(Q, Constant(0), bord1),
    DirichletBC(Q,Constant(0), bord2)
]

# plt.figure(figsize=(10, 5))
# plot(mesh, title='Maillage pour n = 10')
a = epsilon*inner(grad(u), grad(v))*dx + lmbda*inner(u.dx(0), v)*dx
f = Constant(1.)
solve(a==inner(f,v)*dx, w, bcs)
plot(w)