Software

Question

how do i easily use my code?

By Omerin ·
Tags: Software
hello everybody!
I'm a mechanical engineer. during my degree i took an intro to cs in python and loved it and i even sometime use it at work in analyzing technical data. the problem is that the way we learned to actually use the code is very clumsy. for example i wrote a code that receives the data with the input function, and in order to use it i need to make sure the txt file and the py file are in the same folder, go through the terminal, enter the folder directory and write: python "code.py" <"in.txt">"out.txt". not to bad but i would love to know faster friendlier methods that i can use and give others at work to use.
thanks a lot!
Thread display: Collapse - | Expand +

All Answers

Collapse -

That sounds easy if you remember that the command line has been around for

by rproffitt Moderator In reply to how do i easily use my co ...

A very long time. It's considered an essential skill for technical computer use.

But let's say you don't want the user to KNOW HOW TO WRITE THE COMMAND LINE FOR YOUR COMMAND LINE APP.

Easy fix? Write a batch file (often called a script which in psuedo code does this.

Echo "Please enter the input file"
Input inputfile
Echo "Please enter the output file"
Input outputfile
code.py < $inputfile >$outputfile

That's psuedocode and needs work to run on your selected OS but it does make it easier for the users.

You could also add prompts and inputs to your Python app to do this as well.
As there are so many great Python tutorials I'll stop here.

Related Discussions

Related Forums