There are different methods to achieve this. Now we are about to add all the lines one by one to a Python list from this text file. But it is recommended that you do not use linesep for files opened in the text mode. Python raw strings are useful for writing regular expressions and for using with SQL parsers.. Python … List can contain any type of data type. Print Without Newline in Python 2.x. Read a text file in Python. If you want to store numerical data in a text file, you’ll have to convert the data to string format first using the str() function. sb.AppendLine(line) sb.AppendLine("The last line of text.") There is yet another way to insert a new line – by using a platform-independent line breaker. Related Pages. In this for loop, we have printed the characters from the string one by one by its index starting from zero to the length of the string. Python 3 introduced a new way to do string formatting that was also later back-ported to Python 2.7. Given below are a few methods to solve the given task. Python | Removing newline character from string Last Updated: 11-12-2019 Many times, while working with Python strings, we can have a problem in which we have huge amount of data and we need to perform preprocessing of certain kind. In order to print without newline in Python, you need to add an extra argument to your print function that will tell the program that you don’t want your next string to be on a new line.