Reading file in python without linebreak
I want to be able to read a file and add a string onto it line by line without having a line break in the middle.
text_file = open("read_it.txt", "r")
print text_file.readline() + "0123456789"
Outputs to
>>
text
0123456789
>>
I would like have it output to this format
开发者_运维技巧>>
text0123456789
>>
Use the rstrip method:
text_file.readline().rstrip() + "0123456789"
精彩评论