summaryrefslogtreecommitdiff
path: root/snippet.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
committerluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
commitab987e10f154f5536bb8fd936ae0966e909fa969 (patch)
tree9de5076f38b71ececb1bc94f8d9d19170898d603 /snippet.py
added all my scriptssynced/master
Diffstat (limited to 'snippet.py')
-rwxr-xr-xsnippet.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/snippet.py b/snippet.py
new file mode 100755
index 0000000..e3acad4
--- /dev/null
+++ b/snippet.py
@@ -0,0 +1,9 @@
+import re
+with open('/home/lxf/documents/textsnippets.txt', 'r') as f:
+ data = f.read()
+snips = re.split("---", data)
+for snip in snips:
+ # strip the blank line at the end
+ s = '\n'.join(snip.split('\n')[1:-1])
+ #make sure we output the newlines, but no strong wrapping single quotes
+ print(repr(s.strip()).strip('\''))