Use numpy.linalg.norm:
dist = numpy.linalg.norm(a-b)
This works because the Euclidean distance is the l2 norm, and the default value of the ord parameter in numpy.linalg.norm is 2.
For more theory, see Introduction to Data Mining:

Use numpy.linalg.norm:
dist = numpy.linalg.norm(a-b)
This works because the Euclidean distance is the l2 norm, and the default value of the ord parameter in numpy.linalg.norm is 2.
For more theory, see Introduction to Data Mining:

Use scipy.spatial.distance.euclidean:
from scipy.spatial import distance
a = (1, 2, 3)
b = (4, 5, 6)
dst = distance.euclidean(a, b)
Videos
To compute the 0-, 1-, and 2-norm you can either use torch.linalg.norm, providing the ord argument (0, 1, and 2 respectively). Or directly on the tensor: Tensor.norm, with the p argument. Here are the three variants: manually computed, with torch.linalg.norm, and with Tensor.norm.
0-norm
>>> x.norm(dim=1, p=0) >>> torch.linalg.norm(x, dim=1, ord=0) >>> x.ne(0).sum(dim=1)1-norm
>>> x.norm(dim=1, p=1) >>> torch.linalg.norm(x, dim=1, ord=1) >>> x.abs().sum(dim=1)2-norm
>>> x.norm(dim=1, p=2) >>> torch.linalg.norm(x, dim=1, ord=2) >>> x.pow(2).sum(dim=1).sqrt()
To calculate norm of different order, you just have to pass in a ord argument with your desiered order. For example:
torch.linalg.norm(t, dim=1, ord = 0)should work for norm.torch.linalg.norm(t, dim=1, ord = 1)should work for 1-Norm.torch.linalg.norm(t, dim=1, ord = 2)should work for 2-Norm.
And so on.
Python has powerful built-in types, but Python lists are not mathematical vectors or matrices. You could do this with lists, but it will likely be cumbersome for anything more than trivial operations.
If you find yourself needing vector or matrix arithmetic often, the standard in the field is NumPy, which probably already comes packaged for your operating system the way Python also was.
I share the confusion of others about exactly what it is you're trying to do, but perhaps the numpy.linalg.norm function will help:
>>> import numpy
>>> a = numpy.array([1, 2, 3, 4])
>>> b = numpy.array([2, 3, 4, 5])
>>> numpy.linalg.norm((a - b), ord=1)
4
To show how that's working under the covers:
>>> a
array([1, 2, 3, 4])
>>> b
array([2, 3, 4, 5])
>>> (a - b)
array([-1, -1, -1, -1])
>>> numpy.linalg.norm((a - b))
2.0
>>> numpy.linalg.norm((a - b), ord=1)
4
In NumPy, for two vectors a and b, this is just
numpy.linalg.norm(a - b, ord=1)