TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Pythonpy – the swiss army knife of the command line

220 pointsby Russell91almost 11 years ago

14 comments

ctrijuequealmost 11 years ago
Nice. Similar to PyP from Sony Imageworks:<p><a href="http://opensource.imageworks.com/?p=pyp" rel="nofollow">http:&#x2F;&#x2F;opensource.imageworks.com&#x2F;?p=pyp</a><p>The Pyed Piper Tutorial: <a href="http://www.youtube.com/watch?v=eWtVWF0JSJA" rel="nofollow">http:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=eWtVWF0JSJA</a>
评论 #8160590 未加载
评论 #8160919 未加载
k_osalmost 11 years ago
You should put up a donation link. If more people do that and it becomes common practice to donate to useful open source tools &#x2F; projects then imagine what more awesome stuff could be created. Many people desire to build tools but don&#x27;t have the financial support to do so.
评论 #8159421 未加载
评论 #8159569 未加载
zokieralmost 11 years ago
These sorts of things have been one of the strongholds of Perl, glad to see pythonic alternative.
Qantouriscalmost 11 years ago
ls | py -x &#x27;&quot;mv %s %s.txt&quot; % (x,x)&#x27; | sh has me worried, I can&#x27;t find the escape code directly. Also you might wish to offer the following api ls | py -X &#x27;[&quot;mv&quot;,&quot;%s&quot;,&quot;%s.txt&quot;] and run those using processes or sub-process. This would ensure the right argument in the right place. Just an idea.
评论 #8159396 未加载
评论 #8160922 未加载
d0malmost 11 years ago
Looks so useful, can&#x27;t believe I never thought of hacking something to do that. Will experiment with it!
S4Malmost 11 years ago
I like it! Now I can count the number of files I have in a directory:<p><pre><code> ls |py -l &#x27;sum(1 for x in l)&#x27;</code></pre> And also I can count the number of files whose names matche a certain extension:<p><pre><code> ls |grep .py |py -l &#x27;sum(1 for x in l)&#x27; </code></pre> I am not saying it was not possible before, but I don&#x27;t know how to do it in bash.<p>Looking forward to use that for some basic stats on file. The following should sum up the first column of a csv.<p><pre><code> cat data.csv| py -x &#x27;x[0]&#x27; |py -l &#x27;sum(x for x in l)&#x27;</code></pre>
评论 #8159798 未加载
评论 #8159777 未加载
评论 #8159782 未加载
评论 #8159774 未加载
评论 #8159779 未加载
评论 #8159771 未加载
kseistrupalmost 11 years ago
A simpler version of py is e ⌘ <a href="https://pypi.python.org/pypi/e/1.4.5" rel="nofollow">https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;e&#x2F;1.4.5</a>
cohomologoalmost 11 years ago
I attempted to install on Windows - it doesn&#x27;t work due to the lack of os.geteuid(), which is called in the setup.py file to check for root. With a little bit of finagling I could get around that and make it install, but not work due to undefined SIGPIPE in the signal module. It makes sense that this could be UNIX only, but that wasn&#x27;t stated anywhere on the webpage. Perhaps that should be mentioned somewhere.
评论 #8161870 未加载
arno_valmost 11 years ago
For those too lazy to learn the right shell commands ;)
评论 #8159430 未加载
Lambdanautalmost 11 years ago
I usually use Python(or another lang&#x27;s interpreter) as my calculator, so this will save me a few keystrokes in the future. I think I&#x27;ll still use short scripts rather than the command line to do more involved things (like find long palindromes in a txt file), but this will save me a bit of time when doing quick calculations. Thanks!
Grue3almost 11 years ago
Would&#x27;ve been more useful with a language that doesn&#x27;t limit one-liners (e.g. you can&#x27;t have &quot;for x in [1,2,3]: dothing1(x); dothing2(x)&quot;).
leichtgewichtalmost 11 years ago
Reminds me of &#x27;js&#x27;: <a href="https://www.npmjs.org/package/js" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.org&#x2F;package&#x2F;js</a>
评论 #8161857 未加载
mgr86almost 11 years ago
Honest question. Why would I want to use this? I am already quite happy with awk,sed,grep, etc.
fsiefkenalmost 11 years ago
is there a ruby equivalent?
评论 #8159584 未加载
评论 #8161859 未加载