Some code snippets for common tasks

Get the username of the active account logged in:

import getpass
currentUser = getpass.getuser()
print currentUser

Get information about the operating system:

import platform
print platform.system()

print platform.release()

print platform.version()

Create a folder with error checking:

import os
except Exception as err:
	print err

Check if a file or folder exists:

import os
print os.path.exists("C:/test/")