Skip to content

Instantly share code, notes, and snippets.

@TB-O-gh
Created August 1, 2020 08:44
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 TB-O-gh/edce5360a7502636e26ed6cd234c69ef to your computer and use it in GitHub Desktop.
Save TB-O-gh/edce5360a7502636e26ed6cd234c69ef to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import sys
import re
#コマンドライン引数
args = sys.argv
src_url=args[1]
#amazon~dpまでを削除
amazon_site=re.sub(r'https://www.amazon.co.jp/.*dp','https://www.amazon.co.jp/dp',src_url)
#refから後ろを削除
refdell=re.sub(r'ref.*','' ,amazon_site)
item=refdell
print(item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment