Paul's Programming Notes     Archive     Feed     Github

Declaring 2 Variables At The Same Time In Python

I thought this was interesting:

import os
fileName, fileExtension = os.path.splitext('/path/to/somefile.ext') 

Since os.path.splitext returns a list of 2 items, you can assign those 2 list items to variables at the same time with the code above.