Question

Python question When reading and writing into a file. Say i want to read in input...

Python question

When reading and writing into a file. Say i want to read in input using a file called input.txt and then do something. Then i want to output the results to an additional file called output.txt. i have seen ouput.out or results.out used and not .txt. What is the difference? When would you use .out and not .txt? thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output. out and result. out is usually we see in Compiler like when you are using C Programming to run in Linux system For Compiling our c program we use gcc compiler where we have to mansion binary file and our Command is something like if our c file is “hello.c”

=>gcc hello.c –o output (For Compiling our hello.c)

=>./output   (For Running our file)

So in in this it create output. out binary file in here so   

Python is Interpreter so here no any file is being created during execution of python File. If our python file is “first.py”

=>python first.py (Running our file)

So as you seen output.out or result.out is not in python in python as you simply create input.txt for input and for output you can easily make output.txt Nothing Like output.out or result.out in python

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........

Add a comment
Know the answer?
Add Answer to:
Python question When reading and writing into a file. Say i want to read in input...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python Create a program to open a text file for reading, find the maximum number in...

    python Create a program to open a text file for reading, find the maximum number in the file, determine if that maximum number is even, and write to an output text file. You should either write Yes if the number is even, otherwise write the maximum number. You should note the following: • Your input file must be named input.txt • The input file has one integer number per line • Your output file must be named output.txt • Your...

  • I am writing a program in C++, which requires me to read an input text file...

    I am writing a program in C++, which requires me to read an input text file using command line argument. However, I am using xcode on my Macbook to write C++ program, and use terminal instead of command. How do you use int main(int argc, char** argv[]) to read an input file. My professor requires us not to hard code the text file name like .open("example.txt"); Thank you!

  • Help on writing a MATLAB code. Let's say i am given a .txt file and in...

    Help on writing a MATLAB code. Let's say i am given a .txt file and in that text file there are 26 rows that represent individual students grades and then 7 columns that represent specific homework assignments. We want to ask the user to select a specific homework assignment and output the mean and standard deviation for that assignment. Then we want to ask the user to select an individual student and output the mean and standard deviation for that...

  • I need a lot of questions for practicing writing and reading file in Python program to...

    I need a lot of questions for practicing writing and reading file in Python program to study for my final, but I couldn't find it anywhere. Help me, please! :( And also, I barely understand file in Python, so the questions need to be from easy and moderate, please! Thanks for helping!

  • hi, please help in c++. I dont understand how to do this, and a lot of...

    hi, please help in c++. I dont understand how to do this, and a lot of the ways on the internet is confusing me, i am a beginner. with all steps and explantions, will rate! Write a program that determines the frequency of each char in an input file. Your program should . read in an unknown number of chars from an input file named input.txt, • using a function written by you, determine the frequency of occurrence of each...

  • NEED THIS SOON. Recursive Descent Parsing Consider the following BNF grammar: A -> I = E...

    NEED THIS SOON. Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P O P | P O -> + | - | * | / | ** P -> I | L | UI | UL | (E) U -> + | - | ! I -> C | CI C -> a | b | ... | y | z L -> D | DL D -> 0 | 1 | ......

  • Please answer question in C++, thank you. Read in name of input file. File will be...

    Please answer question in C++, thank you. Read in name of input file. File will be formatted as below: filename: triangles1.txt 3 4 5 7 7 7 For each line read in the 3 integer values as the 3 sides of a triangle and calculate the area and print on output line with two decimal points.

  • Suppose we want to read in a file called "input.txt". We can do the following. File...

    Suppose we want to read in a file called "input.txt". We can do the following. File f = new File(input.txt); Scanner s = new Scanner (f); ... We know that Scanner constructor will throw a FileNotFoundException when the file does not exist. Since we already created a file object "f", the file does exist. So why do we need to either throw the exception or do try/catch block to in order to have the program continue? Thanks.

  • I am using python3.6 and i am getting an error on line 42 num = int(fin.readline())...

    I am using python3.6 and i am getting an error on line 42 num = int(fin.readline()) #reading first value valueError: invalid literal, for int() with base 10 Any help is appreciated, here is the code. reads from txt file a few integers in an array and sorts them. thank you! # Function to do insertion sort def insertionSort(arr):     # Traverse through 1 to len(arr)     for i in range(1, len(arr)):         key = arr[i]         # Move elements of...

  • Write a C++ program that takes two sets ’A’ and ’B’ as input read from the...

    Write a C++ program that takes two sets ’A’ and ’B’ as input read from the file prog1 input.txt. The first line of the file corresponds to the set ’A’ and the second line is the set ’B’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT