stoichiograph

Spell words with elemental symbols from the periodic table.
Log | Files | Refs | LICENSE

commit 6fa896ce9ceac64db5b69ec1afef8a2ee3cc9bd8
parent eeed8356b55908d9ef0a248a2e4b3c8e6fed3f53
Author: Amin Mesbah <mesbah.amin@gmail.com>
Date:   Tue, 26 Jan 2016 16:53:49 -0800

import list of symbols from .csv

Diffstat:
Mspeller.py | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/speller.py b/speller.py @@ -1 +1,20 @@ +import csv +def main(): + symbols = get_symbols('elements.csv') + print(symbols) + + +def get_symbols(file_name): + symbols = [] + + with open(file_name) as infile: + csv_reader = csv.reader(infile, skipinitialspace=True, delimiter=',') + next(csv_reader, None) + for row in csv_reader: + symbols.append(row[1]) + + return symbols + +if __name__ == '__main__': + main()