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
430
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
51
Introduction to PyCon US 2024
mariatta
0
250
PEP Talk
mariatta
0
670
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
100
PyConUS2023_Closing.pdf
mariatta
0
130
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
100
Welcome to PyCon US 2023
mariatta
0
89
PyCon US 2023 Lightning Talk
mariatta
0
220
Contributing to Python
mariatta
0
350
Other Decks in Programming
See All in Programming
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
390
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
740
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
370
TipKitTips
ktcryomm
0
160
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
220
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
460
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.6k
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.7k
AHC061解説
shun_pi
0
340
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
220
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
580
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.2k
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
620
Crafting Experiences
bethany
1
80
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
900
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
310
Color Theory Basics | Prateek | Gurzu
gurzu
0
230
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
470
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
150
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
280
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
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