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
590
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
76
PyConUS2023_Closing.pdf
mariatta
0
96
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
76
Welcome to PyCon US 2023
mariatta
0
60
PyCon US 2023 Lightning Talk
mariatta
0
190
Contributing to Python
mariatta
0
310
Other Decks in Programming
See All in Programming
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
180
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
860
童醫院敏捷轉型的實踐經驗
cclai999
0
190
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
46
31k
datadog dash 2025 LLM observability for reliability and stability
ivry_presentationmaterials
0
110
Beyond Portability: Live Migration for Evolving WebAssembly Workloads
chikuwait
0
390
WindowInsetsだってテストしたい
ryunen344
1
190
Select API from Kotlin Coroutine
jmatsu
1
190
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
240
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
310
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
420
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
210
BBQ
matthewcrist
89
9.7k
Raft: Consensus for Rubyists
vanstee
140
7k
A Modern Web Designer's Workflow
chriscoyier
694
190k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Automating Front-end Workflow
addyosmani
1370
200k
Into the Great Unknown - MozCon
thekraken
39
1.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Typedesign – Prime Four
hannesfritz
42
2.7k
Building Adaptive Systems
keathley
43
2.6k
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