Last active
November 14, 2021 02:50
-
-
Save terror/2968c70565a5aea65675fe5041b0435b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import Template | |
def main(): | |
x = 'world' | |
# I. | |
print(f'hello {x}!') | |
# II. | |
print('hello {}!'.format(x)) | |
# III. | |
print('hello %s!' % x) | |
# IV. | |
t = Template('hello $x!') | |
print(t.substitute(x=x)) | |
# lol | |
(lambda s: print('hello {}!'.format(f'{"%s" % Template("$s").substitute(s=s)}')))(x) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment