C:\>pip install natsort
import random
!pip install natsort
from natsort import natsorted
x_sort = [random.randint(1,20) for i in range(15)] # ランダムで数字を生成
print(x_sort)
print(f"sort 並べ替え:{sorted(x_sort)}")
print(f"natsort 並び替え:{natsorted(x_sort)}")
import random
from natsort import natsorted
str_sort = [str(random.randint(1,20)) for i in range(15)]
print(str_sort)
print(f"sort 並べ替え:{sorted(str_sort)}")
print(f"natsort 並び替え:{natsorted(str_sort)}")
C:\>pip install yt-dlp
C:\>yt-dlp 動画URL
yt-dlp 動画URL -f best -o %(upload_date)s_%(title)s.%(ext)s
C:\>pip install pip-review
C:\>pip list -o
C:\>pip-review
C:\>pip-review --auto
C:\>pip-review --interactive
C:\>pip install black
x=1+2
y = 5 - 6
C:\>black sourcecode.py
C:\>python -m black sourcecode.py
,
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"88"
],
"editor.formatOnSave": true,
x = 1 + 2
y = 5 - 6
# fmt: off
を入れておけば、自動整形を防げます。# fmt: on
をかけば自動整形がしてもらえます。# fmt: off
x=1+2 # 維持したい
# fmt: on
y = 5 - 6
C:\>pip install pykakasi
!pip install pykakasi
import pykakasi
kks = pykakasi.kakasi()
print(type(kks))
kanjis = "東京特許許可局"
hurigana = ""
result = kks.convert(kanjis)
print(result)
for res in result:
hurigana += res["hira"]
print(hurigana)