User Profile

Collapse

Profile Sidebar

Collapse
BadOPCode
BadOPCode
Last Activity: May 31 '12, 11:25 PM
Joined: May 30 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • BadOPCode
    replied to Comparing lists
    Well... your syntax I think is a bit off if i'm understanding you correctly. I think this is what you want...

    Code:
    list1 = ['A', 'B', 'C', 'D', 'E']
    list2 = {'A':1, 'C':2, 'D':2, 'F':3}
    for i in list1:
         if list2.has_key(i):
                 print i+':'+str(list2[i])
    list2 is actually a dictionary. Am I sorta close to what you were looking for?
    See more | Go to post

    Leave a comment:


  • BadOPCode
    replied to What is your OS and Python Version
    Arch Linux - Python 3.2 & 2.7 - Gnome Edit
    Win7 - Python 2.7 - Notepad++
    Ubuntu Server 12.04 - Python 3.1 - nano or vi
    See more | Go to post

    Leave a comment:


  • Pfft... hate it when people post RTFM.
    If you just want a simple IO on the script file try

    Code:
    import commands
    
    output = commands.getstatusoutput('/home/transfer/check.sh')
    That will return back a tupple of the return code and the string output to console.
    If thats not quite right, you can check the commands module or if you need even more leverage with the console there is the module...
    See more | Go to post
    Last edited by BadOPCode; May 30 '12, 10:14 PM. Reason: Incomplete info. Appended help on calling Bourne shells not banged.

    Leave a comment:

No activity results to display
Show More
Working...