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
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
f-strings
Lightning talk about f-strings. Presented at PyCascades 2018 in Vancouver.
Mariatta
January 22, 2018
More Decks by Mariatta
See All by Mariatta
There's an API for That!
mariatta
0
68
Introduction to PyCon US 2024
mariatta
0
280
PEP Talk
mariatta
0
840
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
120
PyConUS2023_Closing.pdf
mariatta
0
150
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
130
Welcome to PyCon US 2023
mariatta
0
130
PyCon US 2023 Lightning Talk
mariatta
0
250
Contributing to Python
mariatta
0
400
Other Decks in Programming
See All in Programming
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
110
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
1
610
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
0
280
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
210
自作OSでスライド発表する
uyuki234
1
3.9k
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
520
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
360
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
120
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
340
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
160
1年で人数1.5倍、PR数5.5倍増。 品質とアウトカムはどうなったか、 何が効いたか
ike002jp
0
140
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
5.2k
Featured
See All Featured
Everyday Curiosity
cassininazir
0
260
Abbi's Birthday
coloredviolet
3
8.8k
How to Talk to Developers About Accessibility
jct
2
420
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.1k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
220
Designing Powerful Visuals for Engaging Learning
tmiket
1
450
Discover your Explorer Soul
emna__ayadi
2
1.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
410
What's in a price? How to price your products and services
michaelherold
247
13k
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