[Tutor] sample dictionairies

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Apr 20 09:55:21 CEST 2015


On 20/04/2015 04:49, Jim Mooney wrote:
> For randomly generating data which look like addresses, I use:
>
>> http://www.generatedata.com/
>>
>> While it has 'export to programming language' as a feature, Python isn't
>> one of the supported languages.  Which is fine.  It can export into comma
>> separated values, and writing a Python program to construct a dictionary
>> from comma separated values is easy.
>>
>> Laura
>>
>
> That's a great source, and I can generate dictionaries using the other
> advice. If you don't request comma delimited, each record per line has   |
> as a field delimiter, so making big dicts was easy. Naturally, I tried
> emailing one of the addresses - aliquam at Nunc.org - but it appears to be
> dead ;')
>
> Come to think of it, since I used  |  as a delimiter, what happens if you
> generate a CSV file from data that already has commas in the text?
>

For those who don't know you can use any character as the delimiter and 
any character as the quote, see 
https://docs.python.org/3/library/csv.html#csv.reader

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list