When writing a Python script that can be executed in different operating system environments (Windows/*nix), what are some good ways to set a path? In the example below I would like to have the logfiles stored in the logs folder under the current directory. Is this an acceptable approach (I'm rather new to Python) or are there better ways to achieve this? Thanks
if os.name == 'nt':
logdir=('%s\\logs\\') % (os.getcwd())
else:
logdir=('%s/logs/') % (os.getcwd())
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d-%y %H:%M:%S',
filename='%slogfile.log' % (logdir),
filemode='a')