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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
67
Introduction to PyCon US 2024
mariatta
0
280
PEP Talk
mariatta
0
830
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
400
Other Decks in Programming
See All in Programming
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
370
JavaDoc 再入門
nagise
1
430
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
310
Lessons from Spec-Driven Development
simas
PRO
0
220
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.6k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
610
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.5k
はてなアカウント基盤 State of the Union
cockscomb
1
970
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
810
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
エンジニアに許された特別な時間の終わり
watany
107
250k
What's in a price? How to price your products and services
michaelherold
247
13k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
400
Testing 201, or: Great Expectations
jmmastey
46
8.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Agile that works and the tools we love
rasmusluckow
331
22k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
330
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
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