From cc2d7afc1b6762c38007cfa54169192996cecc98 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Dec 2018 15:31:44 -0500 Subject: [PATCH] removed f-strings, included .ico files --- DemoPrograms/Demo_Base64_Image_Encoder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DemoPrograms/Demo_Base64_Image_Encoder.py b/DemoPrograms/Demo_Base64_Image_Encoder.py index 96fd4517..ad6705f3 100644 --- a/DemoPrograms/Demo_Base64_Image_Encoder.py +++ b/DemoPrograms/Demo_Base64_Image_Encoder.py @@ -19,7 +19,7 @@ def main(): sg.PopupCancel('Cancelled - No valid folder entered') return try: - namesonly = [f for f in os.listdir(folder) if f.endswith('.png')] + namesonly = [f for f in os.listdir(folder) if f.endswith('.png') or f.endswith('.ico')] except: sg.PopupCancel('Cancelled - No valid folder entered') return @@ -29,11 +29,11 @@ def main(): for i, file in enumerate(namesonly): contents = open(os.path.join(folder, file), 'rb').read() encoded = base64.b64encode(contents) - outfile.write(f'{file[:file.index(".")]} = {encoded}\n') + outfile.write('\n{} = {}\n\n'.format(file[:file.index(".")], encoded)) sg.OneLineProgressMeter('Base64 Encoding', i+1, len(namesonly),key='_METER_') outfile.close() - sg.Popup('Completed!', 'Encoded %s files'% i) + sg.Popup('Completed!', 'Encoded %s files'%(i+1)) if __name__ == '__main__':