in this book can be accomplished with the operations listed here nearly all the tasks we encounter in this book can be solved by using combination of split and join in addition to string indexing and slicing examplereading pairs of numbers ( ,yfrom file to summarize some string operations using an exampleconsider the task of reading files in the following format( , ( , ( ,- (- , ( ,- ( , ( , ( ,- ( ,- we want to read these coordinate pairsconvert the numbers to floatsand store them as list of tuples the algorithm is similar to the way we processed files earlier read the file line by line for each linesplit the line into words (each number pair for each wordstrip the parentheses and split the rest with respect to comma to extract the numbers from these operationswe can observe that the split function is probably good toolas it usually is when processing text files to strip the parentheses from the coordinate pairswe canfor instanceuse slicing translated into codethe example can look as followspairs [list of ( pairs of numbers with open('pairs txt'' 'as linesfor line in lineswords line split(for word in wordsword word[ :- strip off parentheses word split(',' float( ) float( pair ( pairs append(pairthere are multiple alternative solutions for reading file in the given formatbut this one is quite simple and also relatively robust with respect to handling different numbers of pairs on each line and variable use of whitespace