Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import List, Tuple, Dict, TextIO
- def names(file:TextIO) -> None:
- """ create a list with all the names from the file
- """
- lines = ""
- firstname = ""
- lastname = ""
- name_list = []
- file = open(file, 'r')
- for line in file:
- line = line.strip()
- lines += line
- for i in range(len(lines)):
- if lines[i] == ",":
- lastname += lines[i+2]
- first = i
- last = i + 3
- while lines[first].islower() and lines[last].islower():
- firstname += lines[first]
- lastname += lines[last]
- first -= 1
- last += 1
- name_list.append(firstname + " " + lastname)
Add Comment
Please, Sign In to add comment