text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
actually a relatively easy fix let me go | 616.68 | 4.14 |
ahead and do this as follows I'm going | 619.14 | 3.42 |
to first remove the old version of | 620.82 | 4.139 |
names.text and now I'm going to change | 622.56 | 4.62 |
my code to do this I'm going to change | 624.959 | 5.221 |
the W quote unquote to just a quote | 627.18 | 5.219 |
unquote a for append which means to add | 630.18 | 3.599 |
to the bottom to the bottom to the | 632.399 | 3.421 |
bottom again and again now let me go | 633.779 | 4.921 |
ahead and rerun python of names.pi and | 635.82 | 5.519 |
enter I'll again start from scratch with | 638.7 | 4.5 |
Hermione because I'm creating the file | 641.339 | 5.841 |
new notice that if I now do code of | 643.2 | 7.379 |
names.txt enter we do see that Hermione | 647.18 | 5.98 |
is back so we've after removing the file | 650.579 | 4.561 |
it did get recreated even though I'm | 653.16 | 4.08 |
using append which is good but now let's | 655.14 | 4.74 |
see what happens when I go back to my | 657.24 | 4.68 |
terminal and this time I run python of | 659.88 | 4.56 |
names.pi again this time typing in Harry | 661.92 | 5.039 |
and let me run it one more time this | 664.44 | 4.62 |
time typing in Ron so hopefully this | 666.959 | 4.021 |
time in that second tab names.text I | 669.06 | 4.56 |
should now see all three of them but but | 670.98 | 6.539 |
but but this doesn't look ideal what | 673.62 | 6.42 |
have I clearly done wrong | 677.519 | 3.601 |
foreign | 680.04 | 3.06 |
something tells me even though all three | 681.12 | 3.36 |
names are there it's not going to be | 683.1 | 3.54 |
easy to read those back unless you know | 684.48 | 5.34 |
where each name ends and Begins the | 686.64 | 6.36 |
English form it's not correctly | 689.82 | 5.639 |
the English format is not correct like | 693 | 5.459 |
it's a correct it's concatenating them | 695.459 | 6.541 |
it is it's it can it's well it appears | 698.459 | 5.461 |
to be concatenating but technically | 702 | 4.14 |
speaking it's just appending to the file | 703.92 | 5.039 |
first Hermione then Harry then Ron it | 706.14 | 4.439 |
has the effect of combining them back to | 708.959 | 3.241 |
back but it's not concatenating per se | 710.579 | 3.781 |
it really is just a pending let's go to | 712.2 | 4.74 |
another hand here what really have I | 714.36 | 5.4 |
done wrong or equivalently how might I | 716.94 | 3.899 |
fix | 719.76 | 3.78 |
it would be nice if there were some kind | 720.839 | 4.5 |
of gaps between each of the names so we | 723.54 | 5.28 |
could read them more cleanly Hello uh we | 725.339 | 7.021 |
should add a new line before we write | 728.82 | 6.12 |
new name good we want to add a new line | 732.36 | 4.44 |
ourselves so whereas print by default | 734.94 | 4.68 |
recall always outputs automatically a | 736.8 | 4.68 |
line ending of backslash n unless we | 739.62 | 3.779 |
override it with the named parameter | 741.48 | 4.32 |
called end write does not do that right | 743.399 | 4.44 |
takes you literally and if you say right | 745.8 | 4.2 |
Hermione that's it you're getting the H | 747.839 | 4.321 |
through the E if you say right Harry you | 750 | 4.44 |
get the H through the uh y you don't get | 752.16 | 5.16 |
any extra new lines automatically so if | 754.44 | 5.22 |
you want to have a new line at the end | 757.32 | 4.019 |
of each of these names we've got to do | 759.66 | 3.299 |
that manually so let me again close | 761.339 | 4.261 |
names.txt and let me remove the current | 762.959 | 4.861 |
file and let me go back up to my code | 765.6 | 3.96 |
here and I can fix this in any number of | 767.82 | 2.94 |
ways but I'm just going to go ahead and | 769.56 | 3.3 |
do this I'm going to write out an F | 770.76 | 4.92 |
string that contains name and backslash | 772.86 | 4.56 |
n at the end we could do this in | 775.68 | 3.3 |
different ways we could manually print | 777.42 | 3.06 |
just the new line or some other | 778.98 | 3.18 |
technique week but I'm going to go ahead | 780.48 | 3.479 |
and use my f strings as I'm in the habit | 782.16 | 3.54 |
of doing and just print to the name and | 783.959 | 3.901 |
the new line all at once I'm going to go | 785.7 | 3.72 |
ahead now and down to my terminal window | 787.86 | 4.08 |
run python of names dot Pi again enter | 789.42 | 4.979 |
we'll type in Hermione I'm going to run | 791.94 | 4.56 |
it again type in Harry I'm going to type | 794.399 | 4.861 |
it again and this time Ron now I'm going | 796.5 | 5.579 |
to run code of names.txt and open that | 799.26 | 6.06 |
file and now it looks like the file is a | 802.079 | 4.801 |
bit cleaner indeed I have each of the | 805.32 | 3.9 |
name on its own line as well as a line | 806.88 | 4.86 |
ending which ensures that we can | 809.22 | 5.28 |
separate one from the other now if I | 811.74 | 5.219 |
were you know writing code I bet I could | 814.5 | 4.62 |
parse that is read the previous file by | 816.959 | 3.841 |
looking at differences between lowercase | 819.12 | 3.12 |
and uppercase letters but that's going | 820.8 | 3.479 |
to get messy quickly generally speaking | 822.24 | 4.32 |
when storing data long term in a file | 824.279 | 3.841 |
you should probably do it somehow | 826.56 | 3.959 |
cleanly like doing one name at a time | 828.12 | 4.74 |
well let's now go back and I'll propose | 830.519 | 3.841 |
that this code is now working correctly | 832.86 | 3.18 |
but we can design it a little bit better | 834.36 | 4.26 |
it turns out that it's all too easy when | 836.04 | 4.5 |
writing code to sometimes forget to | 838.62 | 4.2 |
close files and sometimes this isn't | 840.54 | 4.08 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.