====== Raspberry Board ====== ===== Identify Revision of Board ===== The Model B+ has Revision (int) 16 : '0x10' ==== Easy to understand, but long version ==== # ------------- getRevision of Rasperry Board ------------- def getRevision(): # Extract board revision from cpuinfo file # 16 = B+ myrevision = 0 try: f = open('/proc/cpuinfo','r') for line in f: if line[0:8]=='Revision': length=len(line) myrevision = str(int(line[11:length-1], 16)) f.close() except: myrevision = 0 return myrevision ==== Short Version ==== def getrevision(): rev = ([l[11:-1] for l in open('/proc/cpuinfo','r').readlines() if l[:8]=="Revision"]+['0000'])[0] return (int(rev,16))