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
69
Introduction to PyCon US 2024
mariatta
0
290
PEP Talk
mariatta
0
860
PyCon US 2023: Sunday Morning Welcome Message
mariatta
0
130
PyConUS2023_Closing.pdf
mariatta
0
160
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
260
Contributing to Python
mariatta
0
410
Other Decks in Programming
See All in Programming
MySQLとPostgreSQLって何が違うの?
akagami
0
120
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.4k
バグを直したら useEffect が消えた
colorful12
3
670
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
930
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
590
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
140
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
570
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
1.1k
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
350
リアルな遅延を測る仕様
kota_yata
1
120
プロポーザルを書いてもらう
pvcresin
0
570
初めての模倣学習とVLA
natsutan
0
130
Featured
See All Featured
Everyday Curiosity
cassininazir
0
290
How GitHub (no longer) Works
holman
316
150k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
360
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
A Tale of Four Properties
chriscoyier
163
24k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
930
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Paper Plane
katiecoart
PRO
2
53k
How to train your dragon (web standard)
notwaldorf
97
6.8k
New Earth Scene 8
popppiees
3
2.5k
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