Skip to content

Commit

Permalink
Add solution for problem 54.
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzDiebold committed Jun 28, 2020
1 parent 00f066a commit e16d46f
Show file tree
Hide file tree
Showing 9 changed files with 1,907 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [Project Euler](https://projecteuler.net) Solutions

[![solved: 53 problems](https://img.shields.io/badge/solved-53_problems-f93.svg)](./src)
[![solved: 54 problems](https://img.shields.io/badge/solved-54_problems-f93.svg)](./src)
![Python: 3.8](https://img.shields.io/badge/Python-3.8-3776ab.svg)
[![Lint and Test](https://github.com/FranzDiebold/project-euler-solutions/workflows/Lint%20and%20Test/badge.svg)](https://github.com/FranzDiebold/project-euler-solutions/actions?query=workflow%3A%22Lint+and+Test%22)
[![license: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](./LICENSE.md)
Expand Down
9 changes: 8 additions & 1 deletion src/common/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
File utility functions.
"""

from typing import Iterable
from typing import Iterable, List


def get_items_from_file(file_name: str) -> Iterable[str]:
Expand All @@ -11,3 +11,10 @@ def get_items_from_file(file_name: str) -> Iterable[str]:
for line in file_object:
for item in line.replace('"', '').lower().split(','):
yield item


def get_line_items_from_file(file_name: str, separator: str = ' ') -> Iterable[List[str]]:
"""Get line items as iterable from file with name `file_name` and separator `separator`."""
with open(file_name, 'r') as file_object:
for line in file_object:
yield line.split(separator)
Empty file.
Loading

0 comments on commit e16d46f

Please sign in to comment.