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.9k
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
230
Let's implement useless Python objects
hayaosuzuki
0
1.6k
How to Write Robust Python Code
hayaosuzuki
5
3.9k
Unknown Evolution of the Built-in Function pow
hayaosuzuki
0
1.3k
How to Use In-Memory Streams
hayaosuzuki
1
4.2k
Do you know cmath module?
hayaosuzuki
0
3.2k
Elementary Number Theory with Python
hayaosuzuki
1
3.4k
Django QuerySet "ARE" Patterns
hayaosuzuki
0
3.2k
A Modernization of Legacy Django Based Applications
hayaosuzuki
1
7.6k
Other Decks in Technology
See All in Technology
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
450
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
270
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
260
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
530
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
530
20241220_S3 tablesの使い方を検証してみた
handy
4
390
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
A Philosophy of Restraint
colly
203
16k
Building Adaptive Systems
keathley
38
2.3k
A Tale of Four Properties
chriscoyier
157
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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