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
Python for Everyday
Search
HayaoSuzuki
September 11, 2021
Technology
1
1.7k
Python for Everyday
Python Charity Talks in Japan 2021.09 Lightning Talk
HayaoSuzuki
September 11, 2021
Tweet
Share
More Decks by HayaoSuzuki
See All by HayaoSuzuki
Tasting "Python Distilled"
hayaosuzuki
0
83
Let's implement useless Python objects
hayaosuzuki
0
1.4k
How to Write Robust Python Code
hayaosuzuki
5
3.6k
Unknown Evolution of the Built-in Function pow
hayaosuzuki
0
1.2k
How to Use In-Memory Streams
hayaosuzuki
1
3.8k
Do you know cmath module?
hayaosuzuki
0
2.9k
Elementary Number Theory with Python
hayaosuzuki
1
3.2k
Django QuerySet "ARE" Patterns
hayaosuzuki
0
3k
A Modernization of Legacy Django Based Applications
hayaosuzuki
1
6.8k
Other Decks in Technology
See All in Technology
Databricks Appのご紹介
databricksjapan
0
250
AWSの初級者向けAI・ML資格『AWS Certified AI Practitioner』の傾向と対策/So You Want To Pass AWS Certified AI Practitioner
quiver
0
400
「ばん・さく・つき・たー!」にならないためにSHIROBAKOから 学んだこと
ysknsid25
3
680
AWS Lambdaで実現するスケーラブルで低コストなWebサービス構築/YAPC::Hakodate2024
fujiwara3
7
3.3k
OPENLOGI Company Profile
hr01
0
54k
受託開発でもアジャイル開発できました / Agile in Contract Development
takaking22
9
4.2k
Case Study: Concurrent Counting
ennael
PRO
0
120
【shownet.conf_】クロージングセッション
shownet
PRO
0
310
Webセキュリティのあるきかた
akiym
32
10k
UE5の雑多なテク
ryuichikawano
0
400
【swonet.conf_】NOCメンバーが語るSTMの実態!! ~ShowNetから若者への贈り物~
shownet
PRO
0
310
エムスリーマネジメントチーム紹介資料 / Introduction of M3 Management Team
m3_engineering
0
280
Featured
See All Featured
Debugging Ruby Performance
tmm1
73
12k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Automating Front-end Workflow
addyosmani
1365
200k
How to Ace a Technical Interview
jacobian
275
23k
The Mythical Team-Month
searls
218
43k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
26
4.1k
Into the Great Unknown - MozCon
thekraken
31
1.4k
GitHub's CSS Performance
jonrohan
1030
450k
Bash Introduction
62gerente
608
210k
Producing Creativity
orderedlist
PRO
341
39k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
4
120
Transcript
ৗੜ׆Ͱ͏ Python Python for Everyday Hayao Suzuki Python Charity Talks
in Japan 2021.09 September 11, 2021
Who am I ? ͓લ୭Α ໊લ Hayao Suzukiʢླɹॣʣ Twitter @CardinalXaro
ࣄ Software Developer @ BeProud Inc. › גࣜձࣾϏʔϓϥυ › IT ษڧձࢧԉαʔϏε connpass › ΦϯϥΠϯֶशαʔϏε PyQ › γεςϜ։ൃͷͨΊͷυΩϡϝϯταʔϏε Tracery 2 / 13
Who am I ? ༁ɾࠪಡٕͨ͠ज़ॻʢൈਮʣ › ೖ Python 3 ୈ
2 ൛ (O’Reilly Japan) › Effective Python ୈ 2 ൛ (O’Reilly Japan) › ػցֶशʹΑΔ࣮༻ΞϓϦέʔγϣϯߏங (O’Reilly Japan) › PyTorch ͱ fastai Ͱ͡ΊΔσΟʔϓϥʔχϯά (O’Reilly Japan) › ࣮ફ ࣌ܥྻղੳ (O’Reilly Japan) New! https://xaro.hatenablog.jp/ ʹϦετ͕͋Γ·͢ɻ 3 / 13
Who am I ? ൃදϦετʢൈਮʣ › ϨΨγʔ Django ΞϓϦέʔγϣϯͷݱԽ (DjangoCongress
JP 2018) › SymPy ʹΑΔࣜॲཧ (PyCon JP 2018) › Python ͱָ͠Ήॳ (PyCon mini Hiroshima 2019) › ܅ cmath Λ͍ͬͯΔ͔ (PyCon mini Shizuoka 2020) › ΠϯϝϞϦʔετϦʔϜ׆༻ज़ (PyCon JP 2020) https://xaro.hatenablog.jp/ ʹϦετ͕͋Γ·͢ɻ 4 / 13
ࠓͷςʔϚ ৗੜ׆Ͱ͏ Python › Python ͷ׆༂ॴࣄ͚ͩͰͳ͍ʂ › ৗੜ׆Ͱʹཱͭ Python ඪ४ύοέʔδΛհ͠·͢ɻ
5 / 13
ࠓͷςʔϚ ৗੜ׆Ͱ͏ Python › datetime ύοέʔδ › secrets ύοέʔδ 6
/ 13
࣮ ൃച·ͰͷΧϯτμϯ ʰೖ Python 3 ୈ 2 ൛ʱ͕ 2021
3 ݄ 22 ʹൃߦ͞ΕΔ͕ɺ͋ͱԿͩΖ ͏͔ɻ 7 / 13
ܭࢉ datetime ύοέʔδͰܭࢉ >>> import datetime >>> xday = datetime.date(2021,
3, 22) >>> today = datetime.date(2021, 9, 11) >>> f"༁ຊ͕ൃߦ͞Ε͔ͯΒ{(today - xday).days}ܦա" ' ༁ຊ͕ൃߦ͞Ε͔ͯΒ 173 ܦա' େࣄͳه೦ܭࢉʹͥͻ datetime ύοέʔδΛ͓͏ʂ 8 / 13
࣮ ύεϫʔυΛϥϯμϜʹੜ͍ͨ͠ ύεϫʔυΛొ͍͕ͨ͠ɺ͍·Θ͠Α͘ͳ͍ɻؾܰʹ࡞Γ͍ͨɻ 9 / 13
ύεϫʔυੜ secrets ύοέʔδͰύεϫʔυੜ >>> import secrets >>> secrets.token_urlsafe(8) # จࣈ੍ݶʹԠͯ͡దٓௐ
'rwQ_XUqyrbo' େࣄͳύεϫʔυʹͥͻ secrets ύοέʔδΛ͓͏ʂ ˞ύεϫʔυϚωʔδϟͷ࠾༻ݕ౼͠·͠ΐ͏ɻ 10 / 13
࣮ ൿີͷ࣭ʹਅ໘ʹ͑ͨ͘ͳ͍ मֶཱྀߦͰߦͬͨॴʁ ޫʂ ࡳຈʂ தֶߍͷमֶཱྀߦϨΞέʔεͳͷͰݴ͑·ͤΜɻ 11 / 13
ൿີͷ࣭ secrets ύοέʔδͰൿີͷ࣭ճ import secrets hira = "".join([chr(x) for x
in range(ord("͋"), ord("Μ") + 1)]) kana = "".join([chr(x) for x in range(ord("Ν"), ord("ϲ") + 1)]) cs = hira + kana for _ in range(15): print("".join([secrets.choice(cs) for x in range(8)])) ൿີͷ࣭ʹͥͻ secrets ύοέʔδͰཱ͔͓ͪ͏ʂ 12 / 13
ࠓͷςʔϚ ৗੜ׆Ͱ͏ Python › datetime ύοέʔδɿࠣࡉͳ࣌ܭࢉʹ › secrets ύοέʔδɿ҆શͳύεϫʔυੜʹ 13
/ 13