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
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
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.3k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
2026年 エンジニアリング自己学習法
yumechi
0
130
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
Package Management Learnings from Homebrew
mikemcquaid
0
210
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
250
Grafana:建立系統全知視角的捷徑
blueswen
0
330
CSC307 Lecture 01
javiergs
PRO
0
690
AgentCoreとHuman in the Loop
har1101
5
220
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Test your architecture with Archunit
thirion
1
2.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Ethics towards AI in product and experience design
skipperchong
2
190
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Navigating Weather and Climate Data
rabernat
0
100
So, you think you're a good person
axbom
PRO
2
1.9k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
280
The Curse of the Amulet
leimatthew05
1
8.3k
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