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
410
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
41
Introduction to PyCon US 2024
mariatta
0
220
PEP Talk
mariatta
0
620
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
86
PyConUS2023_Closing.pdf
mariatta
0
110
PyCon US 2023: Saturday Morning Welcome Message
mariatta
0
83
Welcome to PyCon US 2023
mariatta
0
71
PyCon US 2023 Lightning Talk
mariatta
0
200
Contributing to Python
mariatta
0
330
Other Decks in Programming
See All in Programming
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
200
Django Ninja による API 開発効率化とリプレースの実践
kashewnuts
0
1.3k
ソフトウェア設計の実践的な考え方
masuda220
PRO
4
580
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1.1k
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
180
Go言語はstack overflowの夢を見るか?
logica0419
0
260
止められない医療アプリ、そっと Swift 6 へ
medley
1
170
Serena MCPのすすめ
wadakatu
4
990
理論と実務のギャップを超える
eycjur
0
130
ポスターセッション: 「まっすぐ行って、右!」って言ってラズパイカーを動かしたい 〜生成AI × Raspberry Pi Pico × Gradioの試作メモ〜
komofr
0
1.3k
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
220
私はどうやって技術力を上げたのか
yusukebe
43
18k
Featured
See All Featured
How GitHub (no longer) Works
holman
315
140k
It's Worth the Effort
3n
187
28k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
590
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.9k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Code Review Best Practice
trishagee
72
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Faster Mobile Websites
deanohume
310
31k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Docker and Python
trallard
46
3.6k
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