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
38
Introduction to PyCon US 2024
mariatta
0
200
PEP Talk
mariatta
0
600
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
78
PyConUS2023_Closing.pdf
mariatta
0
99
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
78
Welcome to PyCon US 2023
mariatta
0
63
PyCon US 2023 Lightning Talk
mariatta
0
190
Contributing to Python
mariatta
0
310
Other Decks in Programming
See All in Programming
Bedrock AgentCore ObservabilityによるAIエージェントの運用
licux
8
340
Prompt Engineeringの再定義「Context Engineering」とは
htsuruo
0
110
PHPUnitの限界をPlaywrightで補完するテストアプローチ
yuzneri
0
340
CDK引数設計道場100本ノック
badmintoncryer
2
580
ソフトウェア設計とAI技術の活用
masuda220
PRO
25
6.9k
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
200
はじめてのWeb API体験 ー 飲食店検索アプリを作ろうー
akinko_0915
0
170
iOS開発スターターキットの作り方
akidon0000
0
210
CIを整備してメンテナンスを生成AIに任せる
hazumirr
0
290
Quality Gates in the Age of Agentic Coding
helmedeiros
PRO
1
110
バイブスあるコーディングで ~PHP~ 便利ツールをつくるプラクティス
uzulla
1
290
NEWT Backend Evolution
xpromx
1
160
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
77
9.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
How to Ace a Technical Interview
jacobian
278
23k
Scaling GitHub
holman
461
140k
The Cult of Friendly URLs
andyhume
79
6.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
4 Signs Your Business is Dying
shpigford
184
22k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
47
9.6k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
KATA
mclloyd
30
14k
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