How to parse a real python program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to parse a real python program

I want to know, how to parse Python programs together, I don't see it smart to use impure functions to allow program complete many different tasks like: def Calculator(): ... def Converter(): ... while True: print("I have Calculators and Converters") while True: Ca_Co = input() if Ca_Co == "Calculator": Calculator() break elif Ca_Co == "Converter": Converter() break else: print("What you wanted to do?") continue I would use something like that, but I have 2 questions: Do I need another programming languages like Java to parse Python tasks separated in .py files? What difference is on reading .py files and .txt files?

11th Jun 2018, 9:18 AM
Seb TheS
Seb TheS - avatar
2 Answers
+ 1
Hi, depends on what you want. Actually python is enough to pars any file containing any sort of text. So, my question is what you want to see as a result?
21st Jun 2018, 9:21 PM
Nikita Tatiannikov
Nikita Tatiannikov - avatar
0
Nikita Tatiannikov The result would be kind of helper, the helper offers some different tools kind of calculators and text converters. How can those be separated in files and parsed in a program?
22nd Jun 2018, 7:19 AM
Seb TheS
Seb TheS - avatar