Question: Python help! How do i export the results of of my project to a text file? I need to save the question answers to result.txt.
Python help! How do i export the results of of my project to a text file? I need to save the question answers to result.txt.
The file should look like:
Results of analysis:
How many materials the data has:xxx
How many missing values the data has:xxx


from math import * file-open("4material.csv", "r") lines-file readlines) # print (lines) attributes-lines [0].strip().split(",") mapA2Index-th index-0 for x in attributes [1:]: mapA2Index [x.strip()]-index index+-1 spacecount-0 for Line in Lines LL1 materials-line.strip).split(',') for data in materials [1:]: check-data.strip() if check.isspace(): spacecount+1 elif len(check.split))0 spacecount+1 intensitycount-0 for line in lines [1:] intensitycount+1 zerocount-0 for line in lines [1:] materials-line, strip( ) . split(' , ? ) for data in materials [1:]: check-data.strip() if check 0: zerocount+-1 totalintensity-0 for line in lines [1:: materials-Line, strip( ) . split(' ' totalintensity+-float (materials [0]) averageintensity-totalintensity/len(lines [1:])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
