Search This Blog

Python: read string from file

with open ("file.txt", "r") as file:
    # merge to a single line
    data=file.read().replace('\n', '') 

No comments:

Post a Comment