Forums

Execute a Command Prompt Command from Pythonanywhere

import os os.system('cmd /c "date"')

if i run this file the cmd will open and it gives me date . Will this work in pythonanywhere?

cmd is a Windows thing and Pythonanyhwere is running on Linux. You can get a date in python using datetime See https://docs.python.org/3/library/datetime.html.