Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python for Everyday

HayaoSuzuki
September 11, 2021

Python for Everyday

Python Charity Talks in Japan 2021.09 Lightning Talk

HayaoSuzuki

September 11, 2021
Tweet

More Decks by HayaoSuzuki

Other Decks in Technology

Transcript

  1. Who am I ? ͓લ୭Α ໊લ Hayao Suzukiʢླ໦ɹॣʣ Twitter @CardinalXaro

    ࢓ࣄ Software Developer @ BeProud Inc. › גࣜձࣾϏʔϓϥ΢υ › IT ษڧձࢧԉαʔϏε connpass › ΦϯϥΠϯֶशαʔϏε PyQ › γεςϜ։ൃͷͨΊͷυΩϡϝϯταʔϏε Tracery 2 / 13
  2. 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
  3. 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
  4. ࣮࿩ ൃച೔·ͰͷΧ΢ϯτμ΢ϯ ʰೖ໳ Python 3 ୈ 2 ൛ʱ͕ 2021 ೥

    3 ݄ 22 ೔ʹൃߦ͞ΕΔ͕ɺ͋ͱԿ೔ͩΖ ͏͔ɻ 7 / 13
  5. ೔෇ܭࢉ datetime ύοέʔδͰ೔෇ܭࢉ >>> import datetime >>> xday = datetime.date(2021,

    3, 22) >>> today = datetime.date(2021, 9, 11) >>> f"຋༁ຊ͕ൃߦ͞Ε͔ͯΒ{(today - xday).days}೔ܦա" ' ຋༁ຊ͕ൃߦ͞Ε͔ͯΒ 173 ೔ܦա' େࣄͳه೦೔ܭࢉʹͥͻ datetime ύοέʔδΛ࢖͓͏ʂ 8 / 13
  6. ύεϫʔυੜ੒ secrets ύοέʔδͰύεϫʔυੜ੒ >>> import secrets >>> secrets.token_urlsafe(8) # จࣈ਺੍ݶʹԠͯ͡దٓௐ੔

    'rwQ_XUqyrbo' େࣄͳύεϫʔυʹͥͻ secrets ύοέʔδΛ࢖͓͏ʂ ˞ύεϫʔυϚωʔδϟͷ࠾༻΋ݕ౼͠·͠ΐ͏ɻ 10 / 13
  7. ൿີͷ࣭໰ 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