import bhargav_mac_nester cast = [ 'Bhargav', 'Neha', ['Mummy', 'Pappa'], 'Niti', 'Didi', 'Niyati', ['Ba', 'Dada', ['Kaka', 'Kaki']] ] bhargav_mac_nester.print_lol(cast, True)
if role == "Man": man.append(statement) elif role == "Other Man": other.append(statement) except ValueError: pass data.close() except IOError as ioErr: print("IO Error" + str(ioErr)) try: with open("new_man_data.txt", "wb") as new_man_file, open("new_other_man_data.txt", "wb") as new_other_man_file: pickle.dump(man, new_man_file) pickle.dump(other, new_other_man_file) except IOError as ioErr: print("IO Error" + str(ioErr)) except pickle.PickleError as pickleError: print("Pickle Error occurred: " + str(pickleError)) try: with open("new_man_data.txt", "rb") as new_man_file: bhargav_mac_nester.print_lol(pickle.load(new_man_file)) except IOError as ioErr: print("IO Error" + str(ioErr)) except pickle.PickleError as pickleError: print("Pickle Error" + str(pickleError))
elif role == 'Other Man': other.append(statement) except ValueError: pass data.close() except IOError as ioErr: print('IO Error' + str(ioErr)) try: with open('new_man_data.txt', 'wb') as new_man_file, open('new_other_man_data.txt', 'wb') as new_other_man_file: pickle.dump(man, new_man_file) pickle.dump(other, new_other_man_file) except IOError as ioErr: print('IO Error' + str(ioErr)) except pickle.PickleError as pickleError: print('Pickle Error occurred: ' + str(pickleError)) try: with open('new_man_data.txt', 'rb') as new_man_file: bhargav_mac_nester.print_lol(pickle.load(new_man_file)) except IOError as ioErr: print('IO Error' + str(ioErr)) except pickle.PickleError as pickleError: print('Pickle Error' + str(pickleError))
import bhargav_mac_nester cast = ['Bhargav', 'Neha', ['Mummy', 'Pappa'], 'Niti', 'Didi','Niyati',['Ba','Dada',['Kaka','Kaki']]] bhargav_mac_nester.print_lol(cast,True)
statement = statement.strip() if role == 'Man': man.append(statement) elif role == 'Other Man': other.append(statement) except ValueError: pass data.close() except IOError as ioErr: print('IO Error' + str(ioErr)) try: with open('man_speech.txt','w') as man_file: bhargav_mac_nester.print_lol(man, fh=man_file) with open('other_man_speech.txt','w') as other_man_file: bhargav_mac_nester.print_lol(other, fh=other_man_file) except IOError as err: print('File read/write error. \n' + str(err)) except ValueError as valErr: print('ValueError occurred! \n' + str(valErr)) """ finally: if 'man_file' in locals(): man_file.close() if 'other_man_file' in locals(): other_man_file.close() """
statement = statement.strip() if role == 'Man': man.append(statement) elif role == 'Other Man': other.append(statement) except ValueError: pass data.close() except IOError as ioErr: print('IO Error' + str(ioErr)) try: with open('man_speech.txt', 'w') as man_file: bhargav_mac_nester.print_lol(man, fh=man_file) with open('other_man_speech.txt', 'w') as other_man_file: bhargav_mac_nester.print_lol(other, fh=other_man_file) except IOError as err: print('File read/write error. \n' + str(err)) except ValueError as valErr: print('ValueError occurred! \n' + str(valErr)) """ finally: if 'man_file' in locals(): man_file.close() if 'other_man_file' in locals(): other_man_file.close() """