于 2012年04月23日 23:08, Steven D'Aprano 写道:
Lion Chen wrote:
Hi, All,
i am trying write a calculator, now normal calculation works ok. but if
i enter long numbers, for example 33 + 7, it gives me
"12".
there are 18 "3"s, if the length is more than 17, the calcu
nters would be
> appreciated.
> >>>
> >>> Regards
> >>>
> >>> --
> >>> Gerhardus Geldenhuis
> >>>
> >>> ___
> >>> Tutor maillist - Tutor@python.org
> >>>
utor maillist - Tutor@python.org
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>
>> So you want to take 'column1' and get back 1?, 'column10' and get back 10?
>>
>> s =
On Tue, 2012-04-24 at 01:08 +1000, Steven D'Aprano wrote:
[...]
>
> * Use the decimal module instead of floats. You still have finite precision,
> but you can choose how many *decimal* places to store instead of having a
> fixed number of *binary* places. (But decimal is much slower.)
Alterna
On Mon, Apr 23, 2012 at 11:08 AM, Gerhardus Geldenhuis
wrote:
> Hi
> Here is my solution:
>
> def readcsvfile(filename,headerstring):
> headers = headerstring.split(',')
>
> f = open(filename, 'ro')
> csvdata = csv.DictReader(f)
> for row in csvdata:
> for column in headers[0:-1]:
>
Lion Chen wrote:
> Hi, All,
>
> i am trying write a calculator, now normal calculation works ok. but if
> i enter long numbers, for example 33 + 7, it gives me
> "12".
>
> there are 18 "3"s, if the length is more than 17, the calculation will
> be wrong on Wind
Hi
Here is my solution:
def readcsvfile(filename,headerstring):
headers = headerstring.split(',')
f = open(filename, 'ro')
csvdata = csv.DictReader(f)
for row in csvdata:
for column in headers[0:-1]:
print row[column]+',',
print row[headers[-1]]
Regards
On 23 April 2012 15
Hi
Thanks for all the replies, I will try a the suggestions and post my
solution back.
Regards
--
Gerhardus Geldenhuis
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Mon, Apr 23, 2012 at 10:18 AM, nehal dattani wrote:
> Hi,
>
>>
>> Unfortunately I am not, this needs to happen in python.
>>
>>
>
> Please see if following helps.
>
> http://stackoverflow.com/questions/5863999/python-cut-example
>
> Regards,
> Nehal Dattani
>
>
> ___
Hi,
> Unfortunately I am not, this needs to happen in python.
>
>
>
Please see if following helps.
http://stackoverflow.com/questions/5863999/python-cut-example
Regards,
Nehal Dattani
___
Tutor maillist - Tutor@python.org
To unsubscribe or change su
On 2012/04/23 03:46 PM, Gerhardus Geldenhuis wrote:
Not quite,
I have csvfile1:
column1, column2, column3, ... column200
That is my raw data but I want to use only 5 columns for example in a
specific application.
I thus want a file with the following:
column33,column1,column5
I then want to
Yip,
Unfortunately I am not, this needs to happen in python.
Regards
On 23 April 2012 14:59, Christian Witts wrote:
> On 2012/04/23 03:46 PM, Gerhardus Geldenhuis wrote:
>
> Not quite,
>
> I have csvfile1:
> column1, column2, column3, ... column200
>
> That is my raw data but I want to use o
Not quite,
I have csvfile1:
column1, column2, column3, ... column200
That is my raw data but I want to use only 5 columns for example in a
specific application.
I thus want a file with the following:
column33,column1,column5
I then want to read the original csv file and write a new csv file with
On Mon, Apr 23, 2012 at 8:56 AM, Gerhardus Geldenhuis
wrote:
> Hi
> Appologies about the subject I could not think of a better description.
>
> I have this very simple function:
>
> def readcsvfile(filename):
> f = open(filename, 'ro')
> csvdata = csv.DictReader(f)
> for row in csvdata:
>
Hi
Appologies about the subject I could not think of a better description.
I have this very simple function:
def readcsvfile(filename):
f = open(filename, 'ro')
csvdata = csv.DictReader(f)
for row in csvdata:
print row["column3"]+','+row["column1"]
I have another inputfile that will be
Hi, All,
i am trying write a calculator, now normal calculation works ok. but if
i enter long numbers, for example 33 + 7, it gives me
"12".
there are 18 "3"s, if the length is more than 17, the calculation will
be wrong on Windows and Ubuntu.
the following is
16 matches
Mail list logo