Skip to content

Commit ac64855

Browse files
committedApr 25, 2018
Add new file
1 parent 90e598e commit ac64855

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎i_o.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
my_list = [i ** 2 for i in range(1, 11)]
2+
3+
my_file = open("output.txt", "w")
4+
5+
#Writing to a file
6+
for item in my_list:
7+
my_file.write(str(item) + "\n")
8+
my_file.close()
9+
10+
#Reading from a file
11+
my_file = open("output.txt", "r")
12+
print my_file.read()
13+
my_file.close()

0 commit comments

Comments
 (0)