[Python-ideas] Add __main__ for uuid, random and urandom

Wes Turner wes.turner at gmail.com
Mon Apr 18 13:36:41 EDT 2016


On Apr 18, 2016 12:30 PM, "Wes Turner" <wes.turner at gmail.com> wrote:

> >
> > I think the users of oneline.py could be people that now write lots of
> > bash scripts and work on the command line. So whenever someone asks a
> > question somewhere about how to do X on the linux command line, we
> > might have the answer: """
> >
> > Q: On the linux commandline, how do I get only the filename from a
> > full path that is in $FILEPATH
> >
> > A: Python has this. You can use the tools in os.path:
> >
> > Filename:
> > $ oneline.py "os.path.basename('$FILEPATH')"
> >
> > Path to directory:
> > $ oneline.py "os.path.dirname('$FILEPATH')"
> > """
>
> FILEPATH='for'"example');"'subprocess.call("cat /etc/passwd", shell=True)'

sys.argv[1]  (IFS=' ')
stdin (~IFS=$'\n')

...

* https://github.com/westurner/dotfiles/blob/develop/scripts/el

* https://github.com/westurner/pyline/blob/master/pyline/pyline.py
(considering adding an argument (in addition to the existing -m) for
importlib.import_module))

>
> >
> > This might be more appealing than python -c. The whole point is to
> > make Python's power available and visible for a larger audience.
> >
> > -Koos
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160418/de4f383e/attachment-0001.html>


More information about the Python-ideas mailing list