Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a text file that has basic database content. It's supposed to be payroll like information. I try to open it in python with

I have a text file that has basic database content. It's supposed to be payroll like information. I try to open it in python with the below code.

f=open("C:\\User\\Desktop\\School\\Python\\payroll.txt", "r") print(f)

I just get this message "<_io.TextIOWrapper name='C:\\Users\\hmcph\\Desktop\\School\\Python\\payroll.txt' mode='r' encoding='cp1252'> Press any key to continue . . ." Any ideas on why this is happening and how to at least open and read the contents of the text file to python?

The contents below are what I'm trying to read to python...

0000 Kim Allen 7 5 5 3 6 2 0001 Adam Franklin 18 5 8 9 8 8 0002 Chris Deloris 7 4 8 9 5 0003 John Kerney 38 8 8 8 8 8 0004 Michael Husserl 9 3 6 3 4 0005 James Black 15 5 5 8 8 0006 Todd Lidner 20 7.0 6.5 8 8 0007 Melanie McLaird 7 4 4 6 6 6 6 0008 Tim Messelt 13 5 6.5 7 6 7 0009 Mary Allen 25 8 8 7.5 7 4 0010 Kay Simpson 30 8 8 8 8 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions