We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e6f4fd commit ad1530dCopy full SHA for ad1530d
splitstr.py
@@ -1,10 +1,20 @@
1
#!/bin/python3
2
import sys
3
+import subprocess
4
+subprocess.check_call(["stty","-icanon"])
5
if len(sys.argv) == 1:
6
print(f"Usage: {sys.argv[0]} [chunk size]\nSplit a string by X chunk size")
7
sys.exit()
8
n = int(sys.argv[1])
9
text = input("String: ")
10
+print("Text Length:",len(text))
11
+print()
12
+print("++++++++COPY BELOW++++++++")
13
print('Str = ""')
-for i in range(0, len(text), n):
- print("Str = Str + " + '"' + text[i:i+n] + '"')
14
+#chunks = []
15
+chunks = [text[i:i+n] for i in range(0, len(text), n)]
16
+for i in chunks:
17
+ print(f"Str = Str + \"{i}\"")
18
+#print(len(chunks))
19
+subprocess.check_call(["stty","icanon"])
20
+print("++++++++END++++++++")
0 commit comments