r/learnprogramming • • Apr 06 '18

Awesome Python Cheat Sheet

Here is a great cheat sheet for Python by Laurent Pointal (whoever you are). Thanks a ton! :)

If you like this sheet, maybe you are interested in our own cheat sheet course consisting of 5 cheat sheets (keywords, basic and complex data structures, object orientation, and tricks).

1.6k Upvotes

53 comments sorted by

View all comments

51

u/Gobi_The_Mansoe Apr 06 '18

As of python 3.6 you can also use f strings instead of .format. So instead of "This text is variable: {}".format(variable) you can just use f"This text is variable: {variable}" . I find it much easier to keep track of what is going on.

9

u/bicyclepumpinator Apr 06 '18

whoah, I had no clue. Awesome feature which I'll surely use in the future, thanks!

3

u/agrzw Apr 07 '18

I've waited for this sugar for a long time, .format() syntax always looked a little bit ugly as for me, when you have prepared variables for formatting.