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
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
42
Introduction to PyCon US 2024
mariatta
0
230
PEP Talk
mariatta
0
630
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
89
PyConUS2023_Closing.pdf
mariatta
0
110
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
87
Welcome to PyCon US 2023
mariatta
0
74
PyCon US 2023 Lightning Talk
mariatta
0
210
Contributing to Python
mariatta
0
330
Other Decks in Programming
See All in Programming
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
170
CloudflareのSandbox SDKを試してみた
syumai
0
160
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
160
Rails Girls Sapporo 2ndの裏側―準備の日々から見えた、私が得たもの / SAPPORO ENGINEER BASE #11
lemonade_37
2
170
レイトレZ世代に捧ぐ、今からレイトレを始めるための小径
ichi_raven
0
350
Core MIDI を勉強して作曲用の電子ピアノ作ってみた!
hypebeans
0
110
Java_プロセスのメモリ監視の落とし穴_NMT_で見抜けない_glibc_キャッシュ問題_.pdf
ntt_dsol_java
0
210
Vueで学ぶデータ構造入門 リンクリストとキューでリアクティビティを捉える / Vue Data Structures: Linked Lists and Queues for Reactivity
konkarin
1
310
詳細の決定を遅らせつつ実装を早くする
shimabox
1
1.3k
Bakuraku E2E Scenario Test System Architecture #bakuraku_qa_study
teyamagu
PRO
0
760
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
9
4.9k
FlutterKaigi 2025 システム裏側
yumnumm
0
1.1k
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Code Review Best Practice
trishagee
72
19k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Side Projects
sachag
455
43k
Embracing the Ebb and Flow
colly
88
4.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Code Reviewing Like a Champion
maltzj
527
40k
Docker and Python
trallard
46
3.7k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.1k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.1k
Practical Orchestrator
shlominoach
190
11k
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