text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
and it takes more arguments but they're | 6,092.119 | 3.52 |
fairly straightforward the first | 6,093.92 | 4.12 |
argument to re.sub is the pattern the | 6,095.639 | 4.04 |
regular expression that you want to look | 6,098.04 | 4.76 |
for then you have a replacement string | 6,099.679 | 5.241 |
what do you want to replace that pattern | 6,102.8 | 4.2 |
with and where do you want to do all | 6,104.92 | 4.279 |
that will you pass in the string that | 6,107 | 4.56 |
you want to do the substitution on then | 6,109.199 | 3.761 |
there's some other arguments that I'll | 6,111.56 | 3.039 |
wave my hands up for now among them are | 6,112.96 | 3.4 |
those same flags and also a count like | 6,114.599 | 3.52 |
how many times do you want to do find | 6,116.36 | 3.92 |
and replace do you want it to do all or | 6,118.119 | 4 |
do you want to do it just one or so | 6,120.28 | 3.439 |
forth you can have further control there | 6,122.119 | 3.401 |
too just like you would in Google Docs | 6,123.719 | 3.88 |
or Microsoft Word well let me go back to | 6,125.52 | 4.76 |
my code here and let me do this I'm | 6,127.599 | 5 |
going to go ahead and call re not search | 6,130.28 | 5.319 |
but re.sub for substitute I'm going to | 6,132.599 | 5.761 |
pass in the following regular expression | 6,135.599 | 4.281 |
https | 6,138.36 | 3.52 |
col | 6,139.88 | 4.52 |
twitter.com uh slash and then I'm going | 6,141.88 | 4.68 |
to close my quote and now what do I want | 6,144.4 | 4.799 |
to replace that with well like before | 6,146.56 | 4.88 |
with the simple stir replace function I | 6,149.199 | 3.641 |
want to replace it with nothing just get | 6,151.44 | 4.08 |
rid of it all together but what uh | 6,152.84 | 4.279 |
string do I want to pass in to do this | 6,155.52 | 5.4 |
to the URL from the user and now let me | 6,157.119 | 6.241 |
go ahead and assign the return value of | 6,160.92 | 5.279 |
re sub to a variable called username so | 6,163.36 | 5.239 |
re sub's purpose in life is again to | 6,166.199 | 5 |
substitute some value for some regular | 6,168.599 | 3.921 |
expression some number of times it | 6,171.199 | 3.801 |
essentially is find and replace using | 6,172.52 | 4.719 |
regular expressions and it returns to | 6,175 | 4.52 |
you the resulting string once you've | 6,177.239 | 4.681 |
done all those substitutions so now the | 6,179.52 | 3.84 |
very last line of my code can be the | 6,181.92 | 3.799 |
same as before print and I'll use an F | 6,183.36 | 4.92 |
string username colon and then in curly | 6,185.719 | 4.561 |
braces username so I can print out | 6,188.28 | 4.959 |
literally just that all right let's try | 6,190.28 | 4.359 |
this and see what happens I'll clear my | 6,193.239 | 4.201 |
terminal window run python of twitter. | 6,194.639 | 4.881 |
and here we go https | 6,197.44 | 3.64 |
col | 6,199.52 | 4.24 |
twitter.com davidj Ma | 6,201.08 | 6.159 |
cross my fingers and hit enter okay now | 6,203.76 | 5.64 |
we're in business but it is still a | 6,207.239 | 4.96 |
little fragile and so let me ask the | 6,209.4 | 5.759 |
group what problem should I now further | 6,212.199 | 4.92 |
chip away at they've been said before | 6,215.159 | 3.56 |
but let's be clear what's one or more | 6,217.119 | 4.241 |
problems that still remain the protocols | 6,218.719 | 6.801 |
and the uh domain prefixes for good the | 6,221.36 | 7.04 |
protocol so HTTP versus https maybe the | 6,225.52 | 6.56 |
subdomain www should it be there or not | 6,228.4 | 5.48 |
and there's a few other mistakes here | 6,232.08 | 3.639 |
too let me actually stay with the group | 6,233.88 | 3.68 |
what are some other shortcomings of this | 6,235.719 | 6.081 |
current solution um if we use a phrase | 6,237.56 | 6.8 |
like you do before we are going to have | 6,241.8 | 5.72 |
the same problem because it's not taken | 6,244.36 | 6 |
account in the first part of the the | 6,247.52 | 5.48 |
text symbol good I might still allow for | 6,250.36 | 4.96 |
like some words uh some English to the | 6,253 | 3.84 |
left of the URL because I didn't use | 6,255.32 | 3.56 |
like my carrot symbol so I'll fix that | 6,256.84 | 3.6 |
and any final observations on | 6,258.88 | 4.759 |
shortcomings here uh well the could be a | 6,260.44 | 5.84 |
HTTP or there could be like less than | 6,263.639 | 4.96 |
two slashes okay so it could be HTTP and | 6,266.28 | 3.439 |
I think that was mentioned too in terms | 6,268.599 | 2.841 |
of protocol there could be fewer than | 6,269.719 | 4.44 |
two slashes that I'm not going to worry | 6,271.44 | 4.88 |
about if the user gives me one slash | 6,274.159 | 4.48 |
instead of two that's really user error | 6,276.32 | 4.2 |
and I could be tolerant of it but you | 6,278.639 | 4.281 |
know what at that point I'm okay yelling | 6,280.52 | 3.92 |
at them with an error message saying | 6,282.92 | 3.08 |
please fix your input otherwise we could | 6,284.44 | 3.08 |
be here all day long trying to handle | 6,286 | 4.159 |
all possible typos for now I think in | 6,287.52 | 4.92 |
the interest of usability or user | 6,290.159 | 4.921 |
experience ux let's at least be tolerant | 6,292.44 | 5 |
of all possible valid inputs or | 6,295.08 | 4.519 |
reasonable inputs if you will so let me | 6,297.44 | 3.84 |
go here and let me start chipping away | 6,299.599 | 3.321 |
at these here what are some problems we | 6,301.28 | 5.359 |
can solve well let me propose that we | 6,302.92 | 5.88 |
first address the issue of matching from | 6,306.639 | 3.721 |
the beginning of the string so let me | 6,308.8 | 3.72 |
add the carrot to the beginning and let | 6,310.36 | 4.92 |
me add not a dollar sign at the end | 6,312.52 | 3.84 |
though right because I don't want to | 6,315.28 | 2.56 |
match all the way to the end because I | 6,316.36 | 3.799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.