[2.5.1] Converting string to int?

2008-10-23 Thread Gilles Ganault
Hello I'm using the APSW wrapper to SQLite, and I'm stuck at how to pass data from a dictionary to the database which expects an integer: #array filled by reading a two-column text file as input for (isbn,carton) in data.items(): #TypeError: int argument required sql = INSERT

Re: [2.5.1] Converting string to int?

2008-10-23 Thread Gilles Ganault
On Thu, 23 Oct 2008 09:19:07 +0200, Gilles Ganault [EMAIL PROTECTED] wrote: I'm using the APSW wrapper to SQLite, and I'm stuck at how to pass data from a dictionary to the database which expects an integer: Found it: Apparently, this wrapper uses a different placeholder and takes care of

Re: Converting String to int

2006-05-14 Thread Ognjen Bezanov
Hi all, Another problem, with the same error (error: invalid literal for int()) code: mynums = 423.523.674.324.342.122.943.421.762.158.830 mynumArray = string.split(mynums,.) x = 0 for nums in mynumArray: if nums.isalnum() == true: x = x + int(nums) else: print Error,

Re: Converting String to int

2006-05-14 Thread Heiko Wundram
Am Sonntag 14 Mai 2006 22:23 schrieb Ognjen Bezanov: mynums = 423.523.674.324.342.122.943.421.762.158.830 mynumArray = string.split(mynums,.) This is the old way of using string functions using the module string. You should only write this as: mynumArray = mynums.split(.) (using the string

Re: Converting String to int

2006-05-14 Thread Tim Chase
Hi all, Another problem, with the same error (error: invalid literal for int()) Having the actual code would be helpful... code: mynums = 423.523.674.324.342.122.943.421.762.158.830 mynumArray = string.split(mynums,.) x = 0 for nums in mynumArray: if nums.isalnum() == true: