text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
student's name as before the second | 3,833.039 | 3.841 |
element of that list is going to be the | 3,835.14 | 5.76 |
student's home as now before but if I | 3,836.88 | 5.4 |
want to access each of those elements | 3,840.9 | 3.54 |
remember that lists are zero indexed we | 3,842.28 | 3.72 |
start counting at zero and then one | 3,844.44 | 3.54 |
rather than one and then two so if I | 3,846 | 3.359 |
want to get at the student's name I use | 3,847.98 | 3.24 |
Row Bracket zero and if I want to get at | 3,849.359 | 3.541 |
the student's home I use Row Bracket one | 3,851.22 | 4.44 |
but in my for Loop we can do that same | 3,852.9 | 5.52 |
unpacking as before if I know this CSV | 3,855.66 | 5.58 |
is only going to have two columns I | 3,858.42 | 6.119 |
could even do this for name home in | 3,861.24 | 5.94 |
reader and now I don't need to use list | 3,864.539 | 4.8 |
notation I can unpack things all at once | 3,867.18 | 5.82 |
and say name here and home here the rest | 3,869.339 | 5.52 |
of my code can stay exactly the same | 3,873 | 3.72 |
because what am I doing now on line a | 3,874.859 | 3.72 |
I'm still constructing the same | 3,876.72 | 3.96 |
dictionary as before albeit for homes | 3,878.579 | 4.561 |
instead of houses and I'm grabbing those | 3,880.68 | 4.679 |
values now not from the file itself and | 3,883.14 | 4.38 |
my use of split but the reader and again | 3,885.359 | 3.841 |
what the reader is going to do is figure | 3,887.52 | 3.539 |
out where are those commas where are the | 3,889.2 | 4.02 |
quotes and just solve that problem for | 3,891.059 | 4.26 |
you so let me go now down to my terminal | 3,893.22 | 4.5 |
window and run python of students.pi and | 3,895.319 | 5.121 |
hit enter and now we see successfully | 3,897.72 | 5.339 |
sorted no less that Draco is from | 3,900.44 | 5.08 |
malform Manor Harry is from number four | 3,903.059 | 5.881 |
comma privet drive and Ron is from the | 3,905.52 | 6.72 |
borough questions now on this technique | 3,908.94 | 7.74 |
of using CSV reader from that CSV module | 3,912.24 | 6.72 |
which again is just getting us out of | 3,916.68 | 3.78 |
the business of reading each line | 3,918.96 | 3.659 |
ourself and reading each of those commas | 3,920.46 | 4.74 |
and splitting so my questions related to | 3,922.619 | 4.621 |
Something in the past | 3,925.2 | 4.8 |
um I recognize that you are reading a | 3,927.24 | 6.24 |
file every time you well you we're | 3,930 | 6.24 |
assuming that we have the CSV file to | 3,933.48 | 5.52 |
hand already in this case | 3,936.24 | 6.26 |
um is it possible to make a file | 3,939 | 7.74 |
readable and writable so in in in case | 3,942.5 | 7 |
if you want you could you could write | 3,946.74 | 5.879 |
some stuff to the file but then at the | 3,949.5 | 4.26 |
same time you could have another | 3,952.619 | 3.48 |
function that reads through the phone | 3,953.76 | 5.039 |
that's changes to it as you go along a | 3,956.099 | 3.96 |
really good question and the short | 3,958.799 | 3.841 |
answer is yes however historically the | 3,960.059 | 4.381 |
mental model for a file is that of a | 3,962.64 | 3.719 |
cassette tape years ago not really in | 3,964.44 | 4.26 |
use anymore but cassette tapes are | 3,966.359 | 4.021 |
sequential whereby they start at the | 3,968.7 | 2.879 |
beginning and if you want to get to the | 3,970.38 | 3.419 |
end you kind of have to unwind the tape | 3,971.579 | 4.081 |
to get to that point the closest analog | 3,973.799 | 3.421 |
nowadays would be something like Netflix | 3,975.66 | 3.6 |
or any streaming service where there's a | 3,977.22 | 3.72 |
scrubber that you have to go left to | 3,979.26 | 3.42 |
right you can't just jump there or jump | 3,980.94 | 3.899 |
there you don't have Random Access so | 3,982.68 | 3.659 |
the problem with files if you want to | 3,984.839 | 3.72 |
read and write them you or some Library | 3,986.339 | 4.321 |
needs to keep track of where you are in | 3,988.559 | 3.54 |
the file so that if you're reading from | 3,990.66 | 3.54 |
the top and then you write at the bottom | 3,992.099 | 3.601 |
and you want to start reading again you | 3,994.2 | 3.54 |
seek back to the beginning so it's not | 3,995.7 | 3.419 |
something we'll do here in class it's | 3,997.74 | 3.359 |
more involved but it's absolutely doable | 3,999.119 | 4.081 |
for our purposes we'll generally | 4,001.099 | 4.02 |
recommend read the file and then if you | 4,003.2 | 3.3 |
want to change it write it back out | 4,005.119 | 2.7 |
rather than trying to make more | 4,006.5 | 3.78 |
piecemeal changes which is good if | 4,007.819 | 4.441 |
though the file is massive and it would | 4,010.28 | 4.14 |
just be very expensive time wise to | 4,012.26 | 4.02 |
change the whole thing other questions | 4,014.42 | 5.1 |
on this CSV reader | 4,016.28 | 8.22 |
is possible to write a paragraph in that | 4,019.52 | 5.819 |
file | 4,024.5 | 3.119 |
absolutely right now I'm writing very | 4,025.339 | 4.621 |
small strings just names or houses as I | 4,027.619 | 4.021 |
did before but you can absolutely write | 4,029.96 | 4.139 |
as much text as you want | 4,031.64 | 3.959 |
indeed | 4,034.099 | 5.541 |
other questions on CSV reader | 4,035.599 | 4.041 |
IP like input key will be your name or | 4,041.74 | 7.78 |
home so short answer yes we could | 4,046.16 | 5.1 |
absolutely write a program that prompts | 4,049.52 | 4.38 |
the user for a name and a home a name | 4,051.26 | 4.14 |
and a home and we could write out those | 4,053.9 | 3.12 |
values and in a moment we'll see how you | 4,055.4 | 4.8 |
can write to a CSV file for now I'm | 4,057.02 | 5.96 |
assuming as the programmer who created | 4,060.2 | 5.04 |
students.csv that I know what the | 4,062.98 | 3.76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.