For Python. I am supposed to open names.txt file inside of the PythonFiles folder on my C drive using the following code. No matter how I do it, Python refusues to recognize that names.txt exsists. Help?
For Python. I am supposed to open names.txt file inside of the PythonFiles folder on my C drive using the following code. No matter how I do it, Python refusues to recognize that names.txt exsists. Help?
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
For Python. I am supposed to open names.txt file inside of the PythonFiles folder on my C drive using the following code. No matter how I do it, Python refusues to recognize that names.txt exsists. Help?
print("micpor9577")
def readfile():
path = "C:\\PythonFiles\\names.txt"
fopen = open(path, "r")
for line in fopen:
print(line)
fopen.close
readfile()

Transcribed Image Text:Windows (C:)
+ New
>
Pictures
1121
1122
CIS123
10 items
PythonFiles
OneDrive - Perso
This PC
%
Desktop
Documents
> ✓ Downloads
Network
Music
Pictures
Videos
Windows (C:)
> This PC > Windows (C:)
Name
✓ Unspecified (10)
Crash
Logs
PerfLogs
Program Files
Program Files (x86)
Python 3.8
PythonFiles
Users
Windows
Xbox Games
N↓ Sort
Date modified
View
8/22/2022 12:59 PM
4/25/2022 9:51 AM
8/27/2022 3:38 PM
11/14/2022 6:30 AM
11/14/2022 6:30 AM
11/23/2022 1:01 PM
11/23/2022 1:01 PM
4/3/2022 1:35 AM
11/13/2022 7:25 PM
7/20/2022 4:18 PM
⠀
Search Windows (C:)
Type
File folder
File folder
File folder
File folder
File folder
File folder
File folder
File folder
File folder
File folder
Size
<
I
|||||||
X
| |

Transcribed Image Text:ReadNames.py - C:\PythonFiles\ReadNames.py (3.8.8)
File Edit Format Run Options Window Help
print ("micpor9577")
def readfile():
path = "C:\\PythonFiles\\names.txt"
fopen= open (path, "r")
for line in fopen:
print (line)
fopen.close
readfile()
T
X
Ln: 10 Col: 10
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education