Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3: Converting A Tuple To A String

I have the following code:

var_one = var_two[var_three-1]
var_one = "string_one" + var_1

And I need to do the following to it:

var_four = 'string_two', var_one

However, this returns the following error:

TypeError: Can't convert 'tuple' object to str implicity

I have tried things such as str(var_one) and using strip but these did not work. What can I do to achieve the result I require?

EDIT - Here are what the variables contain:

var_one: new variable

var_two: tuple

var_three: integer

var_four: new

EDIT2:

The line in the program that makes the error is: os.system(var_four)

like image 898
Eden Crow Avatar asked Mar 08 '26 08:03

Eden Crow


1 Answers

one_big_string = ''.join(tuple)   
print one_big_string 
like image 138
prelic Avatar answered Mar 10 '26 00:03

prelic