Skip to content

Commit

Permalink
Merge pull request geekcomputers#9 from bevennyamande/patch-2
Browse files Browse the repository at this point in the history
Update testlines.py
  • Loading branch information
geekcomputers committed May 10, 2015
2 parents 95175a9 + 97685bf commit 450170d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions testlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
# Last Modified :
# Version : 1.0

# Modifications :
# Modifications : beven nyamande

# Description : This very simple script open a file and prints out 100 lines of whatever is set for the line variable
# Description : This very simple script open a file and prints out 100 lines of whatever is set for the line variableest you want to print\n" # This sets the variable for the text that you want to print

line="Test you want to print\n" # This sets the variable for the text that you want to print
f=open('mylines.txt','w') # Create the file to store the output
for i in range(1,101): # Loop 100 times
f.write(line) # Write the text to the file
f.close() # Close the file

def write_to_file(filename,txt):
with open(filename,'w') as file_object:
s = file_object.write(txt)


if __name__ == '__main__':
write_to_file('test.txt', 'i am beven')

0 comments on commit 450170d

Please sign in to comment.