Python File I / O does not have poor performance, so you can directly use the file module. You can see what functions are available in it by typing help (file) in the interactive interpreter. Creating a file is part of the core language functionality and does not require you to import file .
Something like:
f = open ("C:\BigScaryFinancialData.txt", "r"); for line in f.readlines():
Disclaimer: This is a response in Python 2. I am not 100% sure that this works in Python 3.
I will leave this to you to figure out how to show the first 10 lines and find the sum of the lines. This can be done using simple program logic, which should not be a problem without any special libraries. Of course, if the lines have some kind of complicated formatting, which makes it difficult to parse the values, you can use some kind of module for parsing, for example, re (type help(re) in the interactive interpreter).
Gravity
source share