Skip to content

Instantly share code, notes, and snippets.

@TakamiChie
Last active October 19, 2020 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakamiChie/ac0c84727288487198562e87eeb9bec2 to your computer and use it in GitHub Desktop.
Save TakamiChie/ac0c84727288487198562e87eeb9bec2 to your computer and use it in GitHub Desktop.
ヨドバシドットコム購入明細メールの商品一覧から商品名と価格を抜き出す
import re
import pyperclip
import sys
from time import sleep
n = []
p = []
text = pyperclip.paste()
for m in re.finditer(r"「([^」]*)」", text, re.MULTILINE):
n.append(re.sub(r"\n\s*", "", m[1]))
for m in re.finditer(r"([\d,]+)\s*円", text, re.MULTILINE):
p.append(re.sub(r"\n\s*", "", m[1]))
ret = ""
for a, r in zip(n, p):
pyperclip.copy(a)
sleep(0.1)
pyperclip.copy(r)
sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment