pymel.versions.parseVersionStr

parseVersionStr(versionStr, extension=False)

Parse a verbose version string (like the one displayed in the Maya title bar) and return the base version.

Parameters:
extension : bool

if True, leave the -x64 tag

>>> from pymel.all import *
>>> versions.parseVersionStr('2008 Service Pack1 x64')
'2008'
>>> versions.parseVersionStr('2008 Service Pack1 x64', extension=True)
'2008-x64'
>>> versions.parseVersionStr('2008x64', extension=True)
'2008-x64'
>>> versions.parseVersionStr('8.5', extension=True)
'8.5'
>>> versions.parseVersionStr('2008 Extension 2')
'2008'
>>> versions.parseVersionStr('/Applications/Autodesk/maya2009/Maya.app/Contents', extension=True)
'2009'
>>> versions.parseVersionStr('C:\Program Files (x86)\Autodesk\Maya2008', extension=True)
'2008'