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
65
Introduction to PyCon US 2024
mariatta
0
280
PEP Talk
mariatta
0
740
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
120
Welcome to PyCon US 2023
mariatta
0
120
PyCon US 2023 Lightning Talk
mariatta
0
250
Contributing to Python
mariatta
0
380
Other Decks in Programming
See All in Programming
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
3.9k
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.3k
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
240
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
150
Oxcを導入して開発体験が向上した話
yug1224
4
290
AIで効率化できた業務・日常
ochtum
0
100
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
370
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
120
Inside Stream API
skrb
1
650
OSもどきOS
arkw
0
460
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.5k
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Navigating Weather and Climate Data
rabernat
0
210
Rails Girls Zürich Keynote
gr2m
96
14k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
The Curious Case for Waylosing
cassininazir
1
380
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
190
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
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