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
390
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
35
Introduction to PyCon US 2024
mariatta
0
180
PEP Talk
mariatta
0
580
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
68
PyConUS2023_Closing.pdf
mariatta
0
90
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
67
Welcome to PyCon US 2023
mariatta
0
58
PyCon US 2023 Lightning Talk
mariatta
0
180
Contributing to Python
mariatta
0
290
Other Decks in Programming
See All in Programming
VitestのIn-Source Testingが便利
taro28
8
2.4k
ウォンテッドリーの「ココロオドル」モバイル開発 / Wantedly's "kokoro odoru" mobile development
kubode
1
260
AI時代の開発者評価について
ayumuu
0
230
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
540
ニーリーQAのこれまでとこれから
nealle
2
160
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
110
RuboCop: Modularity and AST Insights
koic
2
2.4k
スモールスタートで始めるためのLambda×モノリス(Lambdalith)
akihisaikeda
2
340
generative-ai-use-cases(GenU)の推しポイント ~2025年4月版~
hideg
1
370
一緒に働きたくなるプログラマの思想 #QiitaConference
mu_zaru
78
20k
Bedrock × Confluenceで簡単(?)社内RAG
iharuoru
1
110
By the way Google Cloud Next 2025に行ってみてどうだった
ymd65536
0
110
Featured
See All Featured
Making Projects Easy
brettharned
116
6.2k
Build your cross-platform service in a week with App Engine
jlugia
230
18k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
We Have a Design System, Now What?
morganepeng
52
7.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
780
A better future with KSS
kneath
239
17k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Music & Morning Musume
bryan
47
6.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
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