DEV Community

Discussion on: Python Cheatsheet 🔥

Collapse
 
josephsayler profile image
Joseph Sayler • Edited

just an FYI, in the more current versions of Python, dictionaries ARE ordered. to get this functionality in older versions (3.5 or less i think) you can use orderedDict

also for file io, use keyword 'with' to auto close a file you are working on. so do 'with filename as f: ...' and after you are done working with the file, it will be closed

and if you are new to python, master comprehensions (like list and dict) and make use of lambdas