Menu
dat file which is required by Fortune program. ![]() # Read and store the entire file line by line In order to work such code you need to use method - os.path.expanduser.: import osįolder = os.path.expanduser('~/Documents/Fortunes/') The interesting point here is reading Lunux home folder sign - ~. The first step read input text file line by line from the user home directory. The final result is shown below - as you can notice from the line numbers - line number 4 contains long text and it's displayed continuously from Sublime Text while after the execution the same text in on 3 lines: 12, 13, 14:
0 Comments
Leave a Reply. |