Avatar ·

How to remove the newline symbol (\n) when reading lines from a file

📁 Advanced Python Topics, AI

When using File.Readlines() we get something like this:

>>> file.readlines()
['12\n', '10\n', '9\n', '15\n', '10\n', '120']

How to remove \n?