为了账号安全,请及时绑定邮箱和手机立即绑定

print os.path.isdir(r'c:')错误

os.path.isdir(r'c:')能返回Ture,但print os.path.isdir(r'c:')报错

正在回答

4 回答

Python2 的 print 声明已经被 Python3 的 print() 函数取代了,所以,2 里的

print os.path.isdir(r'c:')

在 3 里要写成

print(os.path.isdir(r'c:'))

0 回复 有任何疑惑可以回复我~

http://img1.sycdn.imooc.com//59c8cbc3000169cf02480083.jpg

python 2.7表示没有问题

0 回复 有任何疑惑可以回复我~

import os

print os.path.isdir(r'c:')

python 2.7 测试没有问题 

3.x  print(os.path.isdir(r'c))


0 回复 有任何疑惑可以回复我~

print os.path.isdir(r'C:')你可以试试。。。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
python进阶
  • 参与学习       255532    人
  • 解答问题       3038    个

学习函数式、模块和面向对象编程,掌握Python高级程序设计

进入课程

print os.path.isdir(r'c:')错误

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号