Category Built-in Methods

How to Get the Pythonpath in Shell?

How to Get the Pythonpath in Shell?

Standard-library directories and site-packages still appear in the example’s sys.path with PYTHONPATH unset. For me, the sharper surprise is the blank entry: it represents the current working directory for this -c invocation. Take an importable .py file as a concrete…

Python sorted() to Sort Lists

Python sorted() to Sort Lists

I love that sorted() returns a new list rather than rearranging the tuple in the example. By contrast, list.sort() rearranges mutable_values in the example and returns None. Assign the return value from sorted(values) to ordered. You can print or iterate…