无法在Python中显示文件的内容

时间:2017-04-09 06:52:53

标签: python-3.x automation

我正在尝试从python中的特定位置读取文件内容,在输入选项后,它没有显示任何内容而且它刚出来的程序,任何人都可以指导我这个代码有什么问题?

import os
print('Please Enter the Choice and Press Enter')
print (' 1. Check for Version.xml \n 2. Check for PatchTool.log \n 3. Check for Logger ')

choice = input('Enter your choice: ')
if (choice == 1):
    version=open('d:\\pyhton\\abc.txt', 'r')
    ver = version.read()
    print(ver)

elif (choice == 2):
    xyz=open('d:\\pyhton\\xyz.txt', 'r')
    xyz1 = xyz.read()
    print(xyz1)

elif (choice == 3):
    de=open('d:\\pyhton\\def.txt', 'r')
    de1 = de.read()
    print(de1)

else:
    print('You entered the wrong Choice')

0 个答案:

没有答案