Skip to content

Instantly share code, notes, and snippets.

@TakamiChie
Last active Oct 19, 2020
Embed
What would you like to do?
ヨドバシドットコム購入明細メールの商品一覧から商品名と価格を抜き出す
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