-1

I would like to know how to convert an unknown number of arguments to a string. what I need to do is redirect the output of a function that is supposed to go to print() to a Qt QPlainTextEdit. since it only accepts strings, I need a way to convert the given arguments to a string.

basically what I am looking for is print() but instead of outputting to the terminal, the output is to a string.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

0

If you have an array of elements you can do:

def print_foo(arr,count):
    for i in range(0,int(count)):
        print(str(arr[i]))

Basically, converting to string is - newstr = str(varriable)

Raicha
  • 120
  • 8