Hi Marco,

On Mon, Aug 17, 2009 at 6:17 AM, mrobado<robad...@gmail.com> wrote:
>
> Hi, I'm trying to convert a bunch of strings representing integers to
> sage Integers using the Integer function. The problem is that the
> Integer function assumes the number is in octal if there is a 0 before
> the number. Is there a way to disable this assumption and force
> Integer to treat the strings I am giving it as decimal numbers. If
> this can't be done, I suggest adding this option in the Integer
> function.
> As a workaround, I give my string to int before passing it to Integer.
> like this:
>
> number = Integer( int( "09" ) )
>
> But it would be great to be able to do something like:
>
> number = Integer( "09", radix=decimal )

You can also use the Python string function lstrip() to strip away a
leading character. In your case, you can do this

----------------------------------------------------------------------
| Sage Version 4.1.1, Release Date: 2009-08-14                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: Integer("09".lstrip("0"))
9

-- 
Regards
Minh Van Nguyen

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to