中缀运算符将子进程输出管道传递给python函数

时间:2018-01-03 03:23:55

标签: python xonsh

可以将xonsh管道子进程输出到python函数吗?

ls | wc -l  | int > 20

作为

from toolz import pipe
pipe($(ls |wc -l),int) > 20

我可以近距离接触

# bash
[ $(ls |wc -l ) -gt 20 ] && echo busy dir
# xonsh
test @$(ls |wc -l)  '-gt' 20 and echo busy dir
# xonsh with more python 
len(`[^.].*`) > 20 and echo busy dir

这是搜索端口的方法

%>%

但一般情况下,我希望中缀运算符为magrittr的前导|>coconut's it('creates a user', function(done) { var user = { id: null, name: 'abc', email: 'xyz@gmail.com', phoneNo: 8978567438, picUrl: 'nilu', description: 'SI', status: 'active', waitingTime: 10, rating: 7 }; new Promise((resolve, reject) => { return userService.register(user, (res) => { //log.info('value after insert: ' + JSON.stringify(res)); //expect(res.id).to.be.greaterThan(0); //expect(result.name).to.equal(user.name); //userService.delete(res.id, (res) => {}); }).then((result) => { //expect(result.id).to.be.greaterThan(0); log.info('user value after insert: ' + JSON.stringify(result)); //userService.delete(result.id, (result) => {}); resolve(); }); }).then(() => done()); });

0 个答案:

没有答案