Re: [Tutor] write dictionary to file

2014-06-23 Thread Ian D
I will read this when I get a minute, but I must say thanks for the explanation. tutor@python really is the most helpful mailing list EVER! > Date: Tue, 24 Jun 2014 00:54:30 +1000 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] write dictionary to file > > On Mon, Jun

Re: [Tutor] write dictionary to file

2014-06-23 Thread Steven D'Aprano
On Mon, Jun 23, 2014 at 09:17:44AM +, Ian D wrote: > > for row in spamreader: > > if row['year'] == '40': > > email = row['user'] + '@email.com' > > output = [ row[fieldname] for fieldname in fields ] > > I am unsure about this syntax [ row[fieldname] for fieldname in fiel

Re: [Tutor] write dictionary to file

2014-06-23 Thread Ian D
Ok I used : spamwriter.writerow({'user':email,'first':row['first'],'last':row['last'], 'password':row['password'] }) Seems to be almost finished thanks > From: dux...@hotmail.com > To: tutor@python.org > Date: Mon, 23 Jun 2014 09:17:44 + > Subject:

Re: [Tutor] write dictionary to file

2014-06-23 Thread Peter Otten
Ian, take a step back; the first step to solve a problem is to state it clearly. You want to write a dict to a file. (1) What would the dictionary look like? Give concrete example, e. g. {"foo": 42, "bar": 'that\'s not "funny"'} (2) What should the resulting file look like when you open it in a

Re: [Tutor] Regarding NDEF URL transfer to arduino using python

2014-06-23 Thread Alan Gauld
On 23/06/14 06:56, Shreyas Mangalgi wrote: I want to be able to send URI in NDEF format to my Arduino UNO which is connected to Sony's RC-S801 dynamic NFC tag. I have no idea what most of that means in practice. This looks very Arduino specific so you will probably get better results asking on

Re: [Tutor] write dictionary to file

2014-06-23 Thread Ian D
>> >> import csv >> >> csvfile= open('StudentListToSort.csv', newline='') >> spamreader = csv.DictReader(csvfile,delimiter=',',quotechar='|') > > Are you sure that your input file uses | as a quote character and , as > the field delimiter? No I overlooked this > > >> #open a file to write to l

Re: [Tutor] write dictionary to file

2014-06-23 Thread Ian D
Thanks a lot this is really helpful as have been the other posts. > > Have you tried reading the documentation? It sounds like you're just > throwing random bits of code at it and hoping something works. > > A better approach is to slow down and try to understand what the csv is > doing, what it

Re: [Tutor] Strange issue output not showing up as floats

2014-06-23 Thread Alan Gauld
On 23/06/14 01:32, Deb Wyatt wrote: In future post real code, real output and real errors. That way we have some chance of helping you. -- I know, i'm sorry. I was avoiding posting the actual > code because it was an assignment, Its even more important for assignments because without real co

[Tutor] Regarding NDEF URL transfer to arduino using python

2014-06-23 Thread Shreyas Mangalgi
I want to be able to send URI in NDEF format to my Arduino UNO which is connected to Sony's RC-S801 dynamic NFC tag.I used Hercules setup utility to send "10010100031b0030d102165370d1011255017374757474676172742e736f6e792e646500" for http://www.stuttgart.sony.de and I was a

Re: [Tutor] Strange issue output not showing up as floats

2014-06-23 Thread Deb Wyatt
> > Not if you don't show us your code! > > > never mind. I figured it out. I was using %d instead > > of %f in my print statements. duh. > > 'duh', indeed but how could we possibly have helped since > you didn't post any print statements? > > In future post real code, real output and real