Path: blob/master/Data Analysis using Python/File Handling.ipynb
3074 views
Kernel: Python 3
File Handling
File handling and allows users to handle files i.e., to read and write files, along with many other file handling options, to operate on file.
In [5]:
In [14]:
Out[14]:
enter Name of file you want to open:ashi.txt
['Data \n']
In [15]:
Out[15]:
Data
with python
Data Handling
with python
In [26]:
Out[26]:
['Learn', 'Data', 'Science']
['with', 'python']
[]
['Data', 'Visualization']
Ques: Program to count number of lines in a file
In [27]:
Out[27]:
Number of lines in file: 4
Ques: Program to find largest word in a file
In [30]:
Out[30]:
['HI', 'THis', 'is', 'pythonclasssss', 'Welcomeall', 'study']
The longest word in file = pythonclasssss and its length = 14 :
Ques : A Python program to get the file size of a plain file
In [31]:
Out[31]:
File size in bytes of a plain file: 53
Program to copy one file to another
In [33]:
Out[33]:
'abc.txt'
In [ ]: