Convert arbitrary function inputs to string

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Jan 6 11:34:57 EST 2011


David wrote:
> Hi,
>
> I'd like to have a function that takes arbitrary inputs and returns
> them as a single string, with proper escapes for special characters I
> can define.  For example:
>
> fun( ( + 1 2 ) )
> => "( + 1 2)"
>
> or
>
> fun(  (define (myhello str) (begin (print (string-append "Hello "
> str)) (newline) )) )
> =>  "(define (myhello str) (begin (print (string-append \"Hello \"
> str)) (newline) ))"
>
> Thanks,
>
> -Dave
>   
Are you talking about python ??

fun( ( + 1 2 ) )
  File "<stdin>", line 1
    fun( ( + 1 2 ) )
               ^
SyntaxError: invalid syntax




More information about the Python-list mailing list