My data looks like:
X=[1,2,3,4]
But I need it to look like:
Y=[(1,2,3,4)]
How does one do this in python?
My data looks like:
X=[1,2,3,4]
But I need it to look like:
Y=[(1,2,3,4)]
How does one do this in python?
To do this is simple
>>> X = [1,2,3,4]
>>> [tuple(X)]
[(1, 2, 3, 4)]
Convert X
to a tuple and wrap it in a list. This is only one of probably many ways to do this. It doesn't seem like a very useful thing, so if you could explain why you want to do this, we may be able to suggest some more useful code for you.