In [13]:
f=open('debugging.ipynb')
print('file name',f.name)
print('filemode',f.mode)
print('is file readable',f.readable())
print('is file closed',f.closed)
f.close()
print('file name',f.name)
print('filemode',f.mode)
print('is file readable',f.readable())
print('is file closed',f.closed)
In [14]:
import os
f=open('jnv.txt')
data=f.read()
print(data)
print(os.getcwd())
f.close()
In [9]:
import os
c=os.getcwd()
print(c)
In [16]:
fil=open('jnv.txt','w')
In [19]:
fil.write('navoadaya')
fil.write('vidyalaya kundeshwar tikamgarh')
fil.write('computer science with python ')
Out[19]:
In [22]:
fil.close()
fil=open('jnv.txt','r')
t=fil.readlines()
print(t)
fil.close()
In [4]:
fil.close()
fil=open('jnv.txt','r')
t=fil.readline()
print(t)
In [9]:
fil.close()
fil=open('jnv.txt','r')
t=fil.read()
print(t)
In [11]:
fil.close()
fil=open('jnv.txt','r')
t=fil.read(10)
print(t)
In [11]:
fil.close()
fil=open('jnv.txt','r')
for line in fil:
print(line)
In [13]:
fil.close()
fil=open('jnv.txt','r')
In [16]:
fil.close()
fil=open('jnv.txt','r')
print(fil.read(1))
print(fil.read(2))
print(fil.read())
fil.close()
In [20]:
with open('jnv.txt','r') as f:
print(f.read(1))
print(f.read(2))
print(f.read())
In [3]:
f=open('jnvnew.txt','w')
f.write('navodya vidyalaya')
f.write('kundeshwar')
f.close()
f=open('jnvnew.txt','r')
j=f.read()
print(j)
In [7]:
f=open('jnvnew.txt','a')
f.write('tikamgarh')
f.write('madhyapradesh')
f.close()
f=open('jnvnew.txt','r')
print(f.read())
f.close()
In [13]:
r=open('jnvnew.txt','r')
data=r.read();
data.split()
for j in data:
print(j)
data.close()
In [15]:
n=open('name.txt','a')
while True:
nam=input('enter name for entry enter quit for exit')
n.write(nam)
if nam=='quit':
break
n.close()
In [17]:
fname=input('enter filename')
f=open(fname,'r')
data=f.read()
print(data)
In [19]:
fname=input('enter filename')
f=open(fname,'w')
In [2]:
fname=input('enter filename')
f=open(fname,'w')
while True:
n=input('enter number to feed and quit for exit')
if(n=='0'):
break
f.write(n)
f.close()
f=open(fname,'r')
print(f.read())
In [ ]:
In [ ]:
No comments:
Post a Comment