Skip to main content

Timeline for answer to One liner for printing python's path by J Earls

Current License: CC BY-SA 4.0

Post Revisions

6 events
when toggle format what by license comment
Aug 26, 2025 at 19:28 comment added ShadowRanger Note: While not technically a one-liner, you could just put a literal newline in a quoted command, e.g. python -c 'import sys on the first line, and because the ' wasn't paired, you can continue, entering for p in sys.path: print(p)' on the second line. Doesn't rely on bash-specific functionality like $'', and while technically not a one-liner, when we're talking about scripting languages, "one-liner" often just means "putting a whole script in the command line", which this does.
Aug 26, 2025 at 19:28 history edited J Earls CC BY-SA 4.0
added 178 characters in body
Aug 26, 2025 at 19:18 comment added J Earls @jarmod thanks; added explanation and a second option when running BASH.
Aug 26, 2025 at 19:18 history edited J Earls CC BY-SA 4.0
Add explanation and alternate command when running BASH
Aug 26, 2025 at 0:26 comment added jarmod Your answer would be better if it actually explained why your version works while the OP's does not.
Aug 26, 2025 at 0:18 history answered J Earls CC BY-SA 4.0