0

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.

1
  • 3
    Use self.console_log_ext("".join([str(e) for e in args])) Commented Feb 29, 2020 at 18:15

1 Answer 1

-1

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(variable)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.