def write_urls(urls, cfg):
    for key in cfg['cities']:
        city = key.replace(' ', '_')
        directory = os.path.join('/data', city)
        if (not os.path.exists(directory)):
            os.mkdir(directory)
        file_path = os.path.join(directory, 'urls')
        if (cfg['cities'][key]['download'] != 'photos'):
            print(f'printing {len(urls[city])} urls for city {city} at {file_path}')
            try:
                with open(file_path, 'w') as f:
                    for url in urls[city]:
                        f.write(f'''{url}
''')
                    f.flush()
                    f.close()
            except Exception as err:
                print(f'error: {err} opening file {file_path}')
def write_urls(urls, cfg):
    for key in cfg['cities']:
        city = key.replace(' ', '_')
        directory = os.path.join('/data', city)
        if (not os.path.exists(directory)):
            os.mkdir(directory)
        file_path = os.path.join(directory, 'urls')
        if (cfg['cities'][key]['download'] != 'photos'):
            print(f'printing {len(urls[city])} urls for city {city} at {file_path}')
            try:
                with open(file_path, 'w') as f:
                    for url in urls[city]:
                        f.write(f'{url}
')
                    f.flush()
                    f.close()
            except Exception as err:
                print(f'error: {err} opening file {file_path}')