Guys, can you please share me some sites where we can practice python programs for beginners and Intermediate.
HooDunnit at didly42KahZidly.net
Thu Jun 23 12:39:47 EDT 2016
> On 6/23/2016 11:11 AM, Cousin Stanley wrote:
>> DFS wrote:
>>> Here's a fun one: scraping data off a website,
>>> and storing it in a SQLite database file.
>> After testing your example code here I found
>> that the length of the categories list
>> was 1 less than the terms list after applying
>> dropwords in the terms list comprehension ....
>> The subsequent len comparison then failed
>> and no data was inserted into the data base ....
>> As a fix I added an extra category ....
>> category.append( 'didly' )
>> Subsequently, data was inserted
>> with a single extra category
>> for the last term in terms ....
> Strange! After dropwords, the list lengths match
> for me (both are 152).
Found 153 for terms and 152 for categories,
so I appended 1 to categories ...
> So in your table, is 'didly' now the category for the last term
> 'Rendering'? Mine is 'Technical', as it is on the source webpage.
Last 5 printed from the final loop
just before the db insert ....
Passphrase , Technical
Passcode , Technical
Touchpad , Hardware
Rendering , Technical
> I usually put list length tests in place,
> not sure what happened here.
Possibly a copy/paste difference
on my end ....
Stanley C. Kitching
More information about the Python-list