py-repo

a python playground
Index Commits Files Refs README
commit 83ec5a336a722cd58d3ac66bbaaae5dfd1285442
parent 09cffab05e8db5fa6449b5eb6ca0a1ee80aa5967
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Fri, 12 Feb 2021 17:56:47 -0300

Update: added a simple file operation example

Diffstat:
Afile.py | 12++++++++++++
Amyfile.txt | 2++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/file.py b/file.py
@@ -0,0 +1,12 @@
+
+fileName = "myfile.txt"
+
+# Open or create "myfile.txt";
+f = open(fileName, "w")
+
+f.write("Hello world!")
+f.close()
+
+#open and read the file after the appending:
+f = open(fileName, "r")
+print(f.read())
diff --git a/myfile.txt b/myfile.txt
@@ -0,0 +1 @@
+Hello world!
+\ No newline at end of file