[Tutor] pass tuples to user defined function(beginner)

Mayo Adams mayoadams at gmail.com
Mon Nov 28 18:32:45 CET 2011


I am trying to pass a set of tuple strings from a file to a function I
have defined.  Each tuple is on a separate line, and looks something
like this:
 ('note',2048)
The function has two parameters , and is defined thus: def
findindex(dval,ticks):
Apparently, I need to cast the second value as an integer in the body
of the function in order to work with it as such, but when I attempt
int(ticks) I get
ValueError: invalid literal for int() with base 10: '2048)'

Upon searching for elucidation of this on the internet I find nothing
but esoterica, at least as far as I am concerned.
Any pointers would make me happy.

--
Mayo Adams



mayoadams at gmail.com


More information about the Tutor mailing list