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
41
Introduction to PyCon US 2024
mariatta
0
220
PEP Talk
mariatta
0
630
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
87
PyConUS2023_Closing.pdf
mariatta
0
110
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
84
Welcome to PyCon US 2023
mariatta
0
71
PyCon US 2023 Lightning Talk
mariatta
0
200
Contributing to Python
mariatta
0
330
Other Decks in Programming
See All in Programming
CSC305 Lecture 06
javiergs
PRO
0
270
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
130
テーブル定義書の構造化抽出して、生成AIでDWH分析を試してみた / devio2025tokyo
kasacchiful
0
260
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
6
3k
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
240
スキーマ駆動で、Zod OpenAPI Honoによる、API開発するために、Hono Takibiというライブラリを作っている
nakita628
0
300
What's new in Spring Modulith?
olivergierke
1
160
エンジニアインターン「Treasure」とHonoの2年、そして未来へ / Our Journey with Hono Two Years at Treasure and Beyond
carta_engineering
0
410
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.2k
One Enishi After Another
snoozer05
PRO
0
150
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
6.7k
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
Featured
See All Featured
Writing Fast Ruby
sferik
629
62k
Typedesign – Prime Four
hannesfritz
42
2.8k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Docker and Python
trallard
46
3.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
630
BBQ
matthewcrist
89
9.8k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
610
Scaling GitHub
holman
463
140k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
130k
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