NEW: xonsh examples

This commit is contained in:
xpk 2024-07-04 09:05:59 +08:00
parent 4ae354c009
commit 22a665f1e8
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

9
xonsh/LinesToList.xsh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env xonsh
print("Method1: map and str.strip")
for i in map(str.strip, !(cat /tmp/test.txt)):
print(i)
print("Method2: splitlines")
#for j in $(cat /tmp/test.txt).splitlines():
for j in !(cat /tmp/test.txt).out.splitlines():
print(j)