Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
f-strings
Search
Mariatta
January 22, 2018
Programming
0
410
f-strings
Lightning talk about f-strings. Presented at PyCascades 2018 in Vancouver.
Mariatta
January 22, 2018
Tweet
Share
More Decks by Mariatta
See All by Mariatta
There's an API for That!
mariatta
0
39
Introduction to PyCon US 2024
mariatta
0
210
PEP Talk
mariatta
0
610
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
82
PyConUS2023_Closing.pdf
mariatta
0
100
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
80
Welcome to PyCon US 2023
mariatta
0
67
PyCon US 2023 Lightning Talk
mariatta
0
200
Contributing to Python
mariatta
0
320
Other Decks in Programming
See All in Programming
サーバーサイドのビルド時間87倍高速化
plaidtech
PRO
0
700
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
20
4.9k
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
17
8.5k
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
200
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
390
AIレビュアーをスケールさせるには / Scaling AI Reviewers
technuma
2
240
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.9k
AWS発のAIエディタKiroを使ってみた
iriikeita
1
160
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
140
Improving my own Ruby thereafter
sisshiki1969
1
150
Protocol Buffersの型を超えて拡張性を得る / Beyond Protocol Buffers Types Achieving Extensibility
linyows
0
110
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
A Tale of Four Properties
chriscoyier
160
23k
Git: the NoSQL Database
bkeepers
PRO
431
66k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
800
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Typedesign – Prime Four
hannesfritz
42
2.8k
How GitHub (no longer) Works
holman
315
140k
Become a Pro
speakerdeck
PRO
29
5.5k
For a Future-Friendly Web
brad_frost
180
9.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
What's in a price? How to price your products and services
michaelherold
246
12k
Transcript
F-strings @mariatta
F-strings?
the new way to format strings
starting in Python 3.6
How?
How? "Hello, %s. You’re %s." % (name, age)
How? "Hello, {name}. You’re {age}.".format(name=name, age=age) "Hello, %s. You’re %s."
% (name, age)
How? "Hello, {name}. You’re {age}.".format(name=name, age=age) f"Hello, {name}. You’re {age}."
"Hello, %s. You’re %s." % (name, age)
Alternate usage
Alternate usage f"Hello, {name}. You’re {age}."
Alternate usage F"Hello, {name}. You’re {age}." f"Hello, {name}. You’re {age}."
Call a function >>> def to_uppercase(input): ... return input.upper() ...
>>> name = “bart simpson” >>> print(f"Hi {to_uppercase(name)}!") Hi BART SIMPSON!
Format specifiers >>> pycascades = datetime(year=2018, month=1, day=22) >>> print(f"{pycascades:%b
%d, %Y}") Jan 22, 2018
F-strings
Faster than str.format
Python 3.6
Free download www.python.org
Build from source https://docs.python.org/3.6/using/unix.html
Change your OS consider: MacOS X, Windows 10, fedora 26,
ubuntu 17.10
None