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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
46
Introduction to PyCon US 2024
mariatta
0
250
PEP Talk
mariatta
0
660
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
97
PyConUS2023_Closing.pdf
mariatta
0
120
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
97
Welcome to PyCon US 2023
mariatta
0
84
PyCon US 2023 Lightning Talk
mariatta
0
220
Contributing to Python
mariatta
0
350
Other Decks in Programming
See All in Programming
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
AI & Enginnering
codelynx
0
110
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
970
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
ぼくの開発環境2026
yuzneri
0
100
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
Fluid Templating in TYPO3 14
s2b
0
130
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Patterns of Patterns
denyspoltorak
0
1.4k
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Code Review Best Practice
trishagee
74
20k
30 Presentation Tips
portentint
PRO
1
210
Building Applications with DynamoDB
mza
96
6.9k
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
The untapped power of vector embeddings
frankvandijk
1
1.6k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Into the Great Unknown - MozCon
thekraken
40
2.2k
Ethics towards AI in product and experience design
skipperchong
2
190
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