Skip to content

Instantly share code, notes, and snippets.

@m-mizutani
Created September 4, 2017 03:46
Show Gist options
  • Save m-mizutani/3a59f0b893508882f889cbdc8bae2732 to your computer and use it in GitHub Desktop.
Save m-mizutani/3a59f0b893508882f889cbdc8bae2732 to your computer and use it in GitHub Desktop.
python tips
#!/usr/bin/env python
import datetime
import argparse
from tqdm import tqdm
def log(*args):
msg = ' '.join(map(str, [datetime.datetime.now(), '>'] + list(args)))
print(msg)
with open('log.txt', 'at') as fd: fd.write(msg + '\n')
def main():
psr = argparse.ArgumentParser()
args = psr.parse_args()
print('hello!', args)
if __name__ == '__main__': main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment