命令行版“瑞士军刀” Pythonpy

码农软件 · 软件分类 · 常用工具包 · 2019-08-13 19:27:16

软件介绍

Pythonpy 可看作是命令行版的“瑞士军刀”,能在命令行中直接执行任何 Python 指令。

Usage

浮点运算

$ py '3 * 1.5'
4.5

自动导入任意模块

$ py 'math.exp(1)'
2.71828182846

$ py 'random.random()'
0.103173957713

$ py 'datetime.datetime.now?'
Help on built-in function now:

now(...)
      [tz] -> new datetime with tz's local day and time.

py -x'foo(x)'将 foo 应用到输入的每行

将输入的各行乘以7

$ py 'range(3)' | py -x 'int(x)*7'
0
7
14

抓住 csv 的第二列

$ echo $'a1,b1,c1\na2,b2,c2' | py -x 'x.split(",")[1]'
b1
b2

将 “.text” 附加到目录中的每个文件

$ ls | py -x '"mv `%s` `%s.txt`" % (x,x)' | sh
# sharp quotes are swapped out for single quotes
# single quotes handle spaces in filenames

删除 find 命令返回的每个文件

$ find . -type f | py -x '"rm %s" % x' | sh

只获取2位数字

$ py 'range(14)' | py -x 'x if len(x) == 2 else None'
10
11
12
13

本文地址:https://codercto.com/soft/d/12298.html

Windows核心编程(第5版)

Windows核心编程(第5版)

Jeffrey Richter、Christophe Nasarre / 葛子昂、周靖、廖敏 / 清华大学出版社 / 2008-9 / 99.00元

这是一本经典的Windows核心编程指南,从第1版到第5版,引领着数十万程序员走入Windows开发阵营,培养了大批精英。. 作为Windows开发人员的必备参考,本书是为打算理解Windows的C和C++程序员精心设计的。第5版全面覆盖Windows XP,Windows Vista和Windows Server 2008中的170个新增函数和Windows特性。书中还讲解了Windows......一起来看看 《Windows核心编程(第5版)》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试