I'm trying to insert my list values (test) into a variable (users).
test = ['test', 'test1', 'test2', 'test3']
users = 'api.user_timeline(screen_name = {}, count = 10, wait_on_rate_limit = True)'.format(test)
for user in users:
print(user)
When I run the following command I get.
a
p
i
.
u
s
e
r
_
t
i
m
e
l
i
n
e
(
s
c
r
e
e
n
_
n
a
m
e
=
[
'
t
e
s
t
'
,
'
t
e
s
t
1
'
,
'
t
e
s
t
2
'
,
'
t
e
s
t
3
'
]
,
c
o
u
n
t
=
1
0
,
w
a
i
t
_
o
n
_
r
a
t
e
_
l
i
m
i
t
=
T
r
u
e
)
What I would like is (with or without the ' marks):
'api.user_timeline(screen_name = test, count = 10, wait_on_rate_limit = True)'
'api.user_timeline(screen_name = test1, count = 10, wait_on_rate_limit = True)'
'api.user_timeline(screen_name = test2, count = 10, wait_on_rate_limit = True)'
'api.user_timeline(screen_name = test3, count = 10, wait_on_rate_limit = True)'
I've tried rstrip(), strip(), and removing \n etc but to no avail. I can get it to insert just one value absolutely fine but iterating over the string with the list seems to be the problem. Any help is greatly appreciated.