I need to accept input from the user then store in an array/list.  This is my 
1st python script.

#!/usr/bin/env python
# Derek Smith
# 09/2017
# accept volumes for TSM for tape mgmt.

import os
import sys

nput1 = ""
nput2 = ""
nput1 = input("\nIs your input 'file' based or 'cli' based? ")

if nput1 == "file" :
    nput2 = input("Please provide your input file? ")
    nput2 = nput2.lower()
    print (nput2)
    fh = open(nput2,"r")

    for ln in fh:
        ln = ln.rstrip()
        os.system("/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes 
move drm %s" %ln, "tost=onsiter")
        os.system("/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes 
move drm %s" %ln, "wherest=vaultr tost=onsiter")

elif nput1 == "cli" :
    vols = []
    vols = input("Please enter your volume ids, comma delimited? ")
    vols = vols.upper()
    for vols in vols :
        vols = vols.rstrip()
        print("/usr/bin/dsmadmc -id=dereksmith -password=dereksmith 
-dataonly=yes move drm %s" %vols, "tost=onsiter")
elif
    print ("Incorrect input, exiting.")
    sys.exit(99)


__OUTPUT__

# python tsm_moveVR_tonsiter.py

Is your input 'file' based or 'cli' based? cli
Please enter your volume ids, comma delimited? r20344l5,r20355l5
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm R 
tost=onsiter
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm 2 
tost=onsiter
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm 0 
tost=onsiter
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm 3 
tost=onsiter
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm 4 tost=onsite
...
...
...

Its printing each element per line.  I have tried various changes, read online 
help but gave up looking.
I need it to print as below:


/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm R20344L5 
tost=onsiter
/usr/bin/dsmadmc -id=dereksmith -password=x -dataonly=yes move drm R20355L5 
tost=onsiter

Thank you!!
Derek Smith  |  Unix/TSM Administrator  | Racksquared Data Centers
::  dereksm...@racksquared.com  *: 
www.racksquared.com<http://www.racksquared.com/> |  
www.racksquared.jobs<http://www.racksquared.jobs/>

[cid:image003.png@01D2E9AA.1B9CF8F0]

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to