first of all, do not try to print the time as soon as you create it, create a list (print can take some time and you are trying to debug time sensitive problem, in this case it is not an issue but a good thing to remember when playing around with time...)
times = [dt.datetime.now().strftime("%Y%m%d%H%M%S|%f") for _ in range(1000)]
and then you can take a look at the values you generated - a lot of them are the same still
filter them out and print them in order to take a look at them (divided microseconds to make comparison more obvious)
print(sorted(set(times)))
>>>['20180226192911|002542', '20180226192911|003544', '20180226192911|004547', '20180226192911|005549', '20180226192911|006552']
we can see that the values are spaced apart by roughly 1000 microseconds and this is not caused because we can generate only one value per ms (our list had a lot more values, but they did not change) but because the datetime function does not have precision higher than one ms - this is caused by your OS (older PC could have the precision lower like 16ms and different OS can have different outcomes as well)
The precision of the various real-time functions may be less than suggested by the units in which their value or argument is expressed. E.g. on most Unix systems, the clock “ticks” only 50 or 100 times a second.
https://docs.python.org/3/library/time.html
so aside from using the print in a loop the 5ms differences you see are most likely caused by the clock your OS provides - it is not precise enough