$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
f-strings
Search
Mariatta
January 22, 2018
Programming
0
420
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
44
Introduction to PyCon US 2024
mariatta
0
240
PEP Talk
mariatta
0
640
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
91
PyConUS2023_Closing.pdf
mariatta
0
120
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
90
Welcome to PyCon US 2023
mariatta
0
79
PyCon US 2023 Lightning Talk
mariatta
0
210
Contributing to Python
mariatta
0
340
Other Decks in Programming
See All in Programming
Integrating WordPress and Symfony
alexandresalome
0
150
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.7k
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
730
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
5
2.1k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
450
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
150
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
130
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
120
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
660
connect-python: convenient protobuf RPC for Python
anuraaga
0
400
エディターってAIで操作できるんだぜ
kis9a
0
720
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
The Cult of Friendly URLs
andyhume
79
6.7k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Facilitating Awesome Meetings
lara
57
6.7k
A Tale of Four Properties
chriscoyier
162
23k
4 Signs Your Business is Dying
shpigford
186
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.7k
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