Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Creates MTG deck
import re
CARDLIST = open('deck','r')
opens a text file with a list of cards and quantities formatted as such:
raw_deck = [] ##this list will hold the raw quantity/card name data eg: 22 ISLAND
deck = [] ##this will be the finalized version of the deck with 47 instances of ornithopter
for i in CARDLIST: ##append quantity/cardname to raw deck sans newline characters
def find_card_quantity(raw_deck,deck,card): ##function that separates quantity from card name[\d]+)\s([\w\s]+),raw_deck) ##and appends that to the deck list
card_quantity =
card_name =
for i in card_quantity:
for card in raw_deck: ##cycles through raw_deck, cleaning up the format
find_card_quantity(raw_deck,deck,card) ##and adding the correct quantities to the finished deck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.