Python syntax

New f-string syntax in Python 3.6

https://cito.github.io/blog/f-strings/

>>> name = 'Fred'
>>> age = 42

>>> f'He said his name is {name} and he is {age} years old.'

He said his name is Fred and he is 42 years old.

 

Underscore _ as a variable name in Python

https://stackoverflow.com/questions/1739514/underscore-as-variable-name-in-python

A throwaway variable in Python or the last expression evaluated

Advertisements

Author: Zac

Think & Do

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s