Seminar 3: lists and reading from file_篮球即时比分_nba比分直播-彩客网重点推荐

johansa
2025-09-17T12:36:50.935Z
type:structured-message
www.uio.no

Hi, we'll start seminar 3 by looking at the slides we skipped on Monday; on opening and reading files. We will go through how to save files and your python programs in the same folder, so they can interact. There are two useful functions that are not in the slides, please prepare by looking them up online and see how they work:

1: the function in works on lists to check if a value exists there. For instance like this:

for name in list_of_names

checks if name exists in list_of_names

2: the function .strip() takes away blank spaces and lineshifts from a text, useful when we read a file that contains lineshifts at the end of each line. Like this

name.strip()

will retun name without any blanks before or after