Text_file2 = open ( '/home/imtiaz/file.txt', 'r' ) print ( 'First Method' ) print (text_file ) print ( 'Second Method' ) print (text_file2 ) Text_file = open ( 'file.txt', 'r' ) #Another method using full location With that file object you can proceed your further operation. However, the open(filename, mode) function returns a file object. Suppose, we place a text file name ‘file.txt’ in the same directory where our code is placed. This is is because Windows differentiates between a binary text file and a regular text file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |