Apr-10-2019, 07:39 AM
(This post was last modified: Apr-10-2019, 12:32 PM by ichabod801.)
The Script that I will post will show 2 different results Function - def Report_Results_Fail(): -- Fails Function - def Report_Results_Ok(): -- is OK
I am trying to understand why the first fails
>>>> Result
Running on Imac High Sierra 10.13.6 - Python Version 2.7.10
Report_Results_Fail()
I am trying to understand why the first fails
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
def Processes_Last_Runs_Blanks_Clear(v_User_List): v_Blanks_Clear = [] ; v_Blanks_Clear.append( "--||--" ) for i in range ( len (v_User_List)): v_This = "-" #+" " * v_User_Len #v_This = v_This[0:v_User_Len] v_Blanks_Clear.append(v_This) return v_Blanks_Clear def Active_User_List(): # Read from file so array looks like this v_Users_Active = [] v_Users_Active.append( "Jeff" ) v_Users_Active.append( "Kenny" ) v_Users_Active.append( "Lenny" ) v_Users_Active.append( "Manny" ) v_Users_Active.append( "Nanny" ) return v_Users_Active def Report_Results_Fail(): v_Users_Active = Active_User_List() v_Blanks = Processes_Last_Runs_Blanks_Clear(v_Users_Active) v_Report = [] v_Report.append(v_Blanks) v_Report[ 0 ][ 0 ] = "Process" v_Report[ 0 ][ 1 ] = "Users" for i in range ( 5 ): if i = = len (v_Report): v_Report.append(v_Blanks) v_Report[i][ 1 ] = str (i) for i in range ( len (v_Report)): print i,v_Report[i] def Report_Results_Ok(): v_Users_Active = Active_User_List() v_Report = [] v_Report.append(Processes_Last_Runs_Blanks_Clear(v_Users_Active)) v_Report[ 0 ][ 0 ] = "Process" v_Report[ 0 ][ 1 ] = "Users" for i in range ( 5 ): if i = = len (v_Report): v_Report.append(Processes_Last_Runs_Blanks_Clear(v_Users_Active)) v_Report[i][ 1 ] = str (i) for i in range ( len (v_Report)): print i,v_Report[i] print "Running on Imac High Sierra 10.13.6 - Python Version 2.7.10" print "Report_Results_Fail()" Report_Results_Fail() print "Report_Results_Ok()" Report_Results_Ok() |
Running on Imac High Sierra 10.13.6 - Python Version 2.7.10
Report_Results_Fail()
Output:0 ['Process', '4', '-', '-', '-', '-']
1 ['Process', '4', '-', '-', '-', '-']
2 ['Process', '4', '-', '-', '-', '-']
3 ['Process', '4', '-', '-', '-', '-']
4 ['Process', '4', '-', '-', '-', '-']
Report_Results_Ok()Output:0 ['Process', '0', '-', '-', '-', '-']
1 ['--||--', '1', '-', '-', '-', '-']
2 ['--||--', '2', '-', '-', '-', '-']
3 ['--||--', '3', '-', '-', '-', '-']
4 ['--||--', '4', '-', '-', '-', '-']