Awesome Python Scripts
1. Convert JSON to CSV import json if __name__ == '__main__' : try : with open ( 'input.json' , 'r' ) as f: data = json.loads(f.read()) output = ',' .join([*data[ 0 ]]) for obj in data: output += f'\n {obj[ "Name" ]} , {obj[ "age" ]} , {obj[ "birthyear" ]} ' with open ( 'output.csv' , 'w' ) as f: f.write(output) except Exception as ex: print ( f'Error: { str (ex)} ' ) 2. Password Generator import random import string total = string .ascii_letters + string .digits + string .punctuation length = 16 password = "" .join(random.sample(total, length)) print (password) 3. String search from multiple files import os text = input ( "input text : " ) path = input ( "path : " ) # os.chdir(path) def getfiles ( path ): f = 0 os.chdir(path) files = os.listdir() # ...