Am 27.04.2016 um 11:31 schrieb Peter Otten:
Sibylle Koczian wrote:
And if the csv module is used anyway, why not simply read into a
DictReader?
How would that help with looking up 3.5 by "apple" given the OP's sample
data
banana,4.0
apple,3.5
orange,3.0
Quite right, it wouldn't. Misread
Sibylle Koczian wrote:
> Am 27.04.2016 um 04:42 schrieb jf...@ms4.hinet.net:
>> Just curious:-) why everyone here open the csv file without using
>> newline='' as suggested in Python 3.4.4 document section 14.1?
Carelessness, lack of knowledge (I plead guilty), not on Windows and no
embedded
Am 27.04.2016 um 04:42 schrieb jf...@ms4.hinet.net:
Just curious:-) why everyone here open the csv file without using newline='' as
suggested in Python 3.4.4 document section 14.1?
And if the csv module is used anyway, why not simply read into a DictReader?
--
Just curious:-) why everyone here open the csv file without using newline='' as
suggested in Python 3.4.4 document section 14.1?
--
https://mail.python.org/mailman/listinfo/python-list
>> I am learning python.
>>
>> if I have a csv file, like this
>> banana,4.0
>> apple,3.5
>> orange,3.0
>>
>> Can anyone show me how to read the csv file line by line and then
>> create a dictionary to contain these keys and values?
with open('data.csv') as f:
data = dict([[l.strip() for l
On 2016-04-26 07:18, +dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then
> create a dictionary to contain these keys and values?
import csv
with open('data.csv') as
On Tue, Apr 26, 2016 at 7:18 AM, +dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then create a
> dictionary to contain these keys and values?
>
>
+dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then create a
> dictionary to contain these keys and values?
Below is a spoiler, but learning Python is more fun and
I am learning python.
if I have a csv file, like this
banana,4.0
apple,3.5
orange,3.0
Can anyone show me how to read the csv file line by line and then create a
dictionary to contain these keys and values?
Regards,
+dime+
--
https://mail.python.org/mailman/listinfo/python-list