Created
September 4, 2017 03:46
-
-
Save m-mizutani/3a59f0b893508882f889cbdc8bae2732 to your computer and use it in GitHub Desktop.
python tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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