code-dumps/xonsh/LinesToList.xsh
2024-07-04 09:05:59 +08:00

10 lines
247 B
Plaintext
Executable File

#!/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)