Exercise: parse file
In the following file we have lines:
SOURCE/FILENAME.json,TARGET
read in the file and create
- a single dictionary where the SOURCE/FILENAME.json is the key and the TARGET is the value.
- list of dictionaries in which the keys are 'source', 'filename', and 'target' and the values are from the respective columns (SOURCE, FILENAME.json, and TARGET)
You can solve this for-loop or with map and list-comprehensions. Do it in both ways.
examples/functional/books.txt
agile/agile.json,agile ansible/ansible.json,ansible ansible-intro/ansible.json,ansible-intro aws-lambda/aws.json,aws-lambda bash/bash.json,bash css/css.json,css collab-dev/collab.json,collab-dev data-science/data.json,data-science dart-programming/dart.json,dart-programming docker/docker.json,docker google-gcp/gcp.json,google-gcp git/git.json,git git-intro/git.json,git-intro github-ci/github-ci.json,github-ci golang/go.json,golang groovy/groovy.json,groovy java-programming/java.json,java-programming javascript-programming/javascript.json,javascript-programming jenkins/jenkins.json,jenkins jenkins-intro/jenkins.json,jenkins-intro linux/linux.json,linux linux-intro/linux.json,linux-intro mobile/mobile.json,mobile mojolicious/mojolicious.json,mojolicious mongodb/mongodb.json,mongodb nodejs/nodejs.json,nodejs nosql/nosql.json,nosql pair-programming/pair.json,pair-programming perl-intro/perl.json,perl-intro perl-programming/perl.json,perl-programming perl-programming/testing.json,test-automation-using-perl php-programming/php.json,php-programming programming/programming.json,programming python-mocking/python.json,python-mocking python-programming/python.json,python-programming ruby-programming/ruby.json,ruby=programming sql/sql.json,sql value/value.json,value vim/vim.json,vim web/web.json,web windows-cmd/windows.json,windows-cmd talks/real_world.json,real-world talks/github-pages.json,github-pages talks/python-pair-programming-and-tdd-workshop.json,python-pair-programming-and-tdd-workshop