Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python trouble #1
#6
Excuse me for my ignorance, but I renamed the file with the mountains data to mountain3.txt,also changed the name of the file in the program but I am still getting :
 FileNotFoundError: [Errno 2] No such file or directory: 'mountain3.txt'
UPDATE: It's ok now with
 
with open ('mountain3.txt' ,'r',encoding = 'utf-8') as f :            
     for z in f:
       y =  z.split(',',maxsplit = 4)
       name = y[0]
       height = y[1]
       location = y[2]
       print(name,height,location)            
but the program doesn't do something

update No2
 
x = input('For which mountain do you want to learn ? :')
with open ('mountain3.txt' ,'r',encoding = 'utf-8') as f :            
     for z in f:
       y =  z.split(',',maxsplit = 4)
       name = y[0]
       height = y[1]
       location = y[2]
       b = list(name)
       c = list(height)
       d = list(location)
       for i in range(len(b)+1):
           if x in d:
              print(name[i],height[i],location[i])  #still does not do something
Reply


Messages In This Thread
Python trouble #1 - by Cicada3301 - Nov-16-2021, 10:26 PM
RE: Python trouble #1 - by jefsummers - Nov-16-2021, 10:56 PM
RE: Python trouble #1 - by jefsummers - Nov-17-2021, 05:42 PM
RE: Python trouble #1 - by Cicada3301 - Nov-17-2021, 06:52 PM
RE: Python trouble #1 - by jefsummers - Nov-17-2021, 07:45 PM
RE: Python trouble #1 - by Cicada3301 - Nov-17-2021, 09:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trouble with edX Python Final sarah_mb_sues 11 13,955 Jun-19-2018, 10:36 AM
Last Post: cryomick

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020