Advertisement
j0h

psudo

j0h
Sep 2nd, 2023
1,170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import sys
  4.  
  5. def psudopython(input_file):
  6.     with open(input_file, 'r') as file:
  7.         lines = file.readlines()
  8.  
  9.     modified_lines = []
  10.     for line in lines:
  11.         modified_line = line.replace('#', '    ')  # Replace "#" with four spaces
  12.         modified_lines.append(modified_line)
  13.  
  14.     interpreted_code = ''.join(modified_lines)
  15.  
  16.     # Execute the interpreted code
  17.     try:
  18.         exec(interpreted_code)
  19.     except Exception as e:
  20.         print(f"Error: {e}")
  21.  
  22. if __name__ == "__main__":
  23.     if len(sys.argv) != 2:
  24.         print("Usage: ",  sys.argv[0] ," <input_filename>")
  25.         sys.exit(1)
  26.  
  27.     input_file = sys.argv[1]
  28.     print("#!/usr/bin/env python3\n")
  29.     psudopython(input_file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement