3

I am reading a list with 2 integers from a file using readline(s) which returns a string. How does one convert the string of 2 integers back to 2 integers? Thanks.

sven
  • 51
  • 4

1 Answers1

2

I assume you have a string like "123 456". If so you can do this: map(parse_string, split(s)) where s is your string.

parse_string parses one Maxima expression, e.g. one integer. To get both integers, split the string, which makes a list, and then parse each element of the list.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48