readHexStringFromStream(stream)
File "C:\Python27\lib\site-packages\pyPdf\gen… line 276, in
readHexStringFromStream
txt += chr(int(x, base=16))
ValueError: invalid literal for int() with base 16: '\x00\x00'
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 26, 4:30 pm, Steven D'Aprano wrote:
> On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
> > On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod
> > wrote:
> >> Hi Chris,
> >> Thanks for your help. but i need to to convert the whole string to int.
> >> heres my full code,
> >> ptid = 'item
On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
> On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod
> wrote:
>> Hi Chris,
>> Thanks for your help. but i need to to convert the whole string to int.
>> heres my full code,
>> ptid = 'item_01bom'
>> so item_01bom is a field name in form, so i ge
> On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert wrote:
>> On Mon, Jul 26, 2010 at 3:25 AM, lee wrote:
>> > Hi,
>> >
>> > I have a value,
>> >
>> > partintid = int(Screw plugg (91_10 -> untitled))
>> >
>> > but i get
27;
Hence i get the error. hope i am clear now.
-
Sunny
On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert wrote:
> On Mon, Jul 26, 2010 at 3:25 AM, lee wrote:
> > Hi,
> >
> > I have a value,
> >
> > partintid = int(Screw plugg (91_10 -> untitled))
> >
&g
On Mon, Jul 26, 2010 at 3:25 AM, lee wrote:
> Hi,
>
> I have a value,
>
> partintid = int(Screw plugg (91_10 -> untitled))
>
> but i get ValueError: invalid literal for int(): Screw plugg (91_10 -
>> untitled)
> any help?
That is most certainly not your actu
Hi,
I have a value,
partintid = int(Screw plugg (91_10 -> untitled))
but i get ValueError: invalid literal for int(): Screw plugg (91_10 -
> untitled)
any help?
-
Sunny
--
http://mail.python.org/mailman/listinfo/python-list
Matthias Bläsing wrote:
Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411:
I like the str2num function approach, but then i get left with a float
that has more than 2 decimal spaces , i.e. 11.50 becomes
11.449 and round will not fix that.
Welcome to the wonderful world of float
Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411:
> I like the str2num function approach, but then i get left with a float
> that has more than 2 decimal spaces , i.e. 11.50 becomes
> 11.449 and round will not fix that.
Welcome to the wonderful world of floating point numbers. For
On May 28, 2:22 am, Kam-Hung Soh <[EMAIL PROTECTED]> wrote:
> David Jackson wrote:
> > i used the csv module and saved its contents to a list.
>
> > ['Date', 'No.', 'Description', 'Debit', 'Credit']
> > ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45']
> > ['3/04/2007', '5678', 'THE HOME DEP
David Jackson wrote:
i used the csv module and saved its contents to a list.
['Date', 'No.', 'Description', 'Debit', 'Credit']
['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45']
['3/04/2007', '5678', 'THE HOME DEPOT 263 SomeCity FL', '', '25.40']
the credit/debit fields are strings.
what
En Tue, 27 May 2008 13:00:05 -0300, David Jackson <[EMAIL PROTECTED]>
escribió:
i used the csv module and saved its contents to a list.
['Date', 'No.', 'Description', 'Debit', 'Credit']
['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45']
['3/04/2007', '5678', 'THE HOME DEPOT 263 SomeCity
On Feb 28, 5:56 pm, davidj411 <[EMAIL PROTECTED]> wrote:
> i am parsing a cell phone bill to get a list of all numbers and the
> total talktime spend on each number.
>
> (snipped)
>
> I actually found a good solution.
> (snipped)
If you post 1-2 samples of the cell phone bill input, I am sure you
On Fri, 29 Feb 2008 13:32:15 -0800 (PST)
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > You have to get rid of the double quotes first.
>
> you mean replace them with nothing?
>
> li[4].replace('"','')
Sure, that will do. However, look at the csv module for another way of
handling this.
"davidj411" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|i am parsing a cell phone bill to get a list of all numbers and the
| total talktime spend on each number.
|
| i already have a unique list of the phone numbers.
| now i must go through the list of numbers and add up the tot
> You have to get rid of the double quotes first.
you mean replace them with nothing?
li[4].replace('"','')
once i do that, i should be able to use them as numbers.
--
http://mail.python.org/mailman/listinfo/python-list
og\all_t_mob_nums.py", line 74, in
> getsinglenumbertalktime('"800-218-2644"',talktime)
> File "c:\path\inprog\all_t_mob_nums.py", line 66, in
> getsinglenumbertalktime
> newvar = int(li[5])
> ValueError: invalid literal for int() with base 1
On Thu, 28 Feb 2008 14:56:10 -0800 (PST)
davidj411 <[EMAIL PROTECTED]> wrote:
> ValueError: invalid literal for int() with base 10: '"2"'
>
>
> here is the question:
>
> How can i convert a string number like "2" to a true number that can
type:
"2"li[5] type:
Traceback (most recent call last):
File "", line 1, in
File "c:\path\inprog\all_t_mob_nums.py", line 74, in
getsinglenumbertalktime('"800-218-2644"',talktime)
File "c:\path\inprog\all_t_mob_nums.py", line
the literal. If somestring is a non-decimal
integer literal (something else), then radix is necessary, and not just
helpful, for correct execution.
>>> int('033')
33
>>> int('033', 8)
27
>>> int('1a3')
Traceback (most recent call la
File "", line 1, in ?
ValueError: invalid literal for int(): 1.0
>>> int("1e+10", 10)
Traceback (most recent call last):
File "", line 1, in ?
ValueError: invalid literal for int(): 1e+10
>>> int("1.00e+10", 10)
Traceback (most rece
)
Traceback (most recent call last):
File "", line 1, in ?
ValueError: invalid literal for int(): 1.0
>>> int('1x')
Traceback (most recent call last):
File "", line 1, in ?
ValueError: invalid literal for int(): 1x
Terry J. Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-02-14, Martin MOKREJ© <[EMAIL PROTECTED]> wrote:
> is this a bug or "feature" that I have to use float() to make int()
> autoconvert
> from it?
It's a feature. Integers don't have decimal points...
--
Grant Edwards grante Yow! I just had a NOSE
Martin MOKREJ© wrote:
> is this a bug or "feature" that I have to use float() to make int()
> autoconvert
> from it?
it's by design, of course. "1.00e+00" is not an integer.
if you want to treat a floating point literal as an integer, you have to
use an explicit conversion.
--
or "license" for more information.
a = 1
"%5.10e" % (a)
'1.00e+00'
int("%5.10e" % (a))
Traceback (most recent call last):
File "", line 1, in ?
ValueError: invalid literal for int(): 1.00e+00
int(float("%5.10e" % (a)))
1
--
http://mail.python.org/mailman/listinfo/python-list
25 matches
Mail list logo