-2

i want to use fabric control my remote host

i want to fabric input shell command line to Code branch

example:

the shell code:

root@debian:~# cd /root

the fabric:

con.run('cd /root')

i want input shell code like this :

root@debian:~# cd \
root@debian:~# /root

how can i write my fabric code

i have a shell command with a long parameter, so i need to code branch

1 Answers1

3

Using a list comprehension.

lists = [['a','b'],['c','d','e']]
print([j for i in lists for j in i])

or using itertools

import itertools
print(list(itertools.chain.from_iterable(lists)))

Output:

['a', 'b', 'c', 'd', 'e']
Rakesh
  • 81,458
  • 17
  • 76
  • 113