尝试通过win python 3读取文本文件,奇怪的是我没有得到任何错误或任何输出。 TAI。
f = open ('C:\\Users\\test\\Desktop\\test.txt','r')
data = f.read()
print data
f.close()
答案 0 :(得分:1)
print
是py3中的一个函数
f = open ('C:\\Users\\test\\Desktop\\test.txt','r')
data = f.read()
print(data)
f.close()
但是,它应该会给你无效的语法错误。
答案 1 :(得分:-2)
class Item:
def __init__(self, Name = "NA",ID = -1,Price = -1):
self.Name = Name
self.ID = ID
self.Price = Price
def __str__(self):
return "Name is %s,Id is %d,and price is %f" %(self.Name,self.Id,self.price)
ob=Item ()
ob1=Item("deepak",121,120.00)
print(ob)
print(ob1)
我在运行时没有得到输出。任何人都可以帮助我。