-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile.py
More file actions
34 lines (30 loc) · 692 Bytes
/
file.py
File metadata and controls
34 lines (30 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 20 19:45:40 2017
@author: root
"""
# Open a file
'''
fo = open("foo.txt", "wb")
print ("Name of the file: ", fo.name)
print ("mode of the file: ", fo.mode)
print ("Name of the file: ", fo.closed)
# Close opend file
fo.close()
print ("Name of the file: ", fo.closed)
'''
# Open a file
str = input('Enter the content of the file: ')
#fo = open("foo.txt", "w")
fo = open("foo.txt", "a+")
#fo.write( "Python is a great language.\nYeah its great!!\n",str);
fo.write( str);
# Close opend file
fo.close()
# Open a file
fo = open("foo.txt", "r+")
str = fo.read();
print ("Read String is : ", str)
# Close opend file
fo.close()