Question

  • Creator
    Topic
  • #2140639

    how do i easily use my code?

    by omerin ·

    Tags: 

    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!

You are posting a reply to: how do i easily use my code?

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

  • Author
    Replies
    • #2415753
      Avatar photo

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

      by rproffitt ·

      In reply to how do i easily use my code?

      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.

Viewing 0 reply threads