Hello!
#!/usr/bin/env python
hn = "simsa-svr"
for container in containerslist:
Name = container['Names']
I want to print Name along with hn i,e simsa-svr. I tried like Name = container['Names']'-'.join(hn) did not work.
Needed result:
lilly2232321-simsa-svr
You are using join
wrong in the above example. Join needs a list or tuple of strings:
>>> '-'.join(('north','east','south','west'))
'north-east-south-west'
Alternatively use the add (+)
operator:
>>> 'Grace' + 'Kelly'
'GraceKelly'
Andrew
1 Like
Name = str(container['Names'])
print str(Name[0])+'-'+hn
But it does print extra / in front of
/lilly2232321-simsa-svr
How to get rid of it?
---------- Post updated at 08:13 PM ---------- Previous update was at 07:06 AM ----------
Just used this along with Name
.replace("/","")+
It works.