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