SANKAR ., 11.01.2011 01:00:
I am reading a Test.txt (see atatchment) file using following code to get
the T2:
F =open('C:\Test.txt','r')
T1 = F.readlines()
for i in range(len(T1)):
T2 = T1[i].split(',')
print(T2)
Take a look at the "csv" module in the standard library.
Stefan
On Jan 11, 4:02 am, Chris Rebert wrote:
> On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . wrote:
> > Hello There,
>
> > I am from non IT field also new to python programming.Could you
> > please help me to solve the following problem?
>
> > I have a list T1 with following format:
>
> > T1 = [ '
Thanks Alan!
-Sankar
On Tue, Jan 11, 2011 at 2:50 PM, Alan Meyer wrote:
> On 1/10/2011 6:02 PM, Chris Rebert wrote:
>
>> On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . wrote:
>>
>>> Hello There,
>>>
>>>
>>>I am from non IT field also new to python programming.Could you
>>> please help me to
On 1/10/2011 6:02 PM, Chris Rebert wrote:
On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . wrote:
Hello There,
I am from non IT field also new to python programming.Could you
please help me to solve the following problem?
I have a list T1 with following format:
T1 = [ ' "Field" ' , ' "12.5"
Hi Chris ,
Thanks for your response.
I am reading a Test.txt (see atatchment) file using following code to get
the T2:
F =open('C:\Test.txt','r')
T1 = F.readlines()
for i in range(len(T1)):
T2 = T1[i].split(',')
print(T2)
Regards
Sankar
On Tue, Jan 11, 2011 at 10:02 AM, Chris Re
On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . wrote:
> Hello There,
>
> I am from non IT field also new to python programming.Could you
> please help me to solve the following problem?
>
> I have a list T1 with following format:
>
> T1 = [ ' "Field" ' , ' "12.5" ', ' "2.5" ']
>
> How do get the
Hello There,
I am from non IT field also new to python programming.Could you
please help me to solve the following problem?
I have a list T1 with following format:
T1 = [ *' "*Field*" **' , ' "*12.5*" **', ' "*2.5*" ']*
* *
How do get the list elements without double quote in my output (T
Andreas Hofmann wrote:
I've got some strings, which only contain numbers plus eventually one
character as si-postfix (k for kilo, m for mega, g for giga). I'm trying
to convert those strings to integers, with this function:
Why bother to always switch the case if you only use a few values?
Als
Thanks a lot, I got it working now.
Thanks also to the other guys, your numerous hints were really valuable!
Kind regards,
Andy
John Machin schrieb:
On Sep 7, 7:04 am, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
Hello Folks!
I've got a little problem here, which which really creeps me out at t
Andreas Hofmann, there are several problems in your code:
> if type(value) is str:
Better to use isinstance() and to compare it with basestring instead.
> value.upper()
This does nothing, python strings are immutable, so they don't get
changed in-place, so you have to
On Sep 7, 7:29 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote:
> On Sat, 06 Sep 2008 23:04:14 +0200, Andreas Hofmann wrote:
> > if mult is 1:
>
> ^^
> You're testing for identity, not for equality.
> Change it to "if mult == 1". Is it alright now?
>
Althou
On Sep 7, 7:04 am, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
> Hello Folks!
>
> I've got a little problem here, which which really creeps me out at the
> moment.
> I've got some strings, which only contain numbers plus eventually one
> character as si-postfix (k for kilo, m for mega, g for giga).
On Sat, 06 Sep 2008 23:04:14 +0200, Andreas Hofmann wrote:
Hi,
> I've got a little problem here, which which really creeps me out at the
> moment.
> I've got some strings, which only contain numbers plus eventually one
> character as si-postfix (k for kilo, m for mega, g for giga). I'm trying
On Sep 6, 5:04 pm, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
> Hello Folks!
>
> I've got a little problem here, which which really creeps me out at the
> moment.
> I've got some strings, which only contain numbers plus eventually one
> character as si-postfix (k for kilo, m for mega, g for giga).
Hello Folks!
I've got a little problem here, which which really creeps me out at the
moment.
I've got some strings, which only contain numbers plus eventually one
character as si-postfix (k for kilo, m for mega, g for giga). I'm trying
to convert those strings to integers, with this function:
Chris Spencer wrote:
> Is there any library for Python that implements a kind of universal
> number object. Something that, if you divide two integers, generates a
> ratio instead of a float, or if you take the square root of a negative,
> generates a complex number instead of raising an exception?
Am Sonntag, den 28.08.2005, 21:36 + schrieb Chris Spencer:
> Is there any library for Python that implements a kind of universal
> number object. Something that, if you divide two integers, generates a
> ratio instead of a float, or if you take the square root of a negative,
> generates a co
Chris Spencer wrote:
> Is there any library for Python that implements a kind of universal
> number object. Something that, if you divide two integers, generates a
> ratio instead of a float, or if you take the square root of a negative,
> generates a complex number instead of raising an exception
Is there any library for Python that implements a kind of universal
number object. Something that, if you divide two integers, generates a
ratio instead of a float, or if you take the square root of a negative,
generates a complex number instead of raising an exception? Lisp has
something like
On 6 Apr 2005 12:01:23 -0700, [EMAIL PROTECTED] wrote:
>I'm writing a program to read in raw data from a WAV file, and write it
>to an IT file. I got this to work in C by reading the data into an
>array of unsigned chars called "RawDataAry", then converted it to
>signed chars by doing the followi
[EMAIL PROTECTED] wrote:
fmt = str(chunklen) + 'B'
fmtsize = struct.calcsize(fmt)
rawdata = struct.unpack(fmt, s[:fmtsize])
rawdata = list(rawdata)
Then I tried to convert it:
charary = array.array('b')
charary.fromlist(rawdata)
Uh, don't you want to be consistent in your use
of signed and unsigned
I'm writing a program to read in raw data from a WAV file, and write it
to an IT file. I got this to work in C by reading the data into an
array of unsigned chars called "RawDataAry", then converted it to
signed chars by doing the following:
signed char *CharAry = malloc(sizeof(signed char) * fra
Yes, I suppose exceptions are the best way to handle this problem.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I am reading an ASCII data file and converting some of the strings to
integers or floats. However, some of the data is corrupted and the
conversion doesn't work. I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me.
You should r
I am reading an ASCII data file and converting some of the strings to
integers or floats. However, some of the data is corrupted and the
conversion doesn't work. I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me. I would like
to simply perform a pre-
[EMAIL PROTECTED] wrote:
I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me.
Stop worrying and learn to love exceptions. :)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
26 matches
Mail list logo