鱼C论坛

 找回密码
 立即注册
查看: 3063|回复: 2

请教各位,为什么跟小甲鱼老师的程序相同,但是第一行内容老师写不进去呢

[复制链接]
发表于 2014-9-4 15:14:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. filename = input('please enter the file name: ')
  2. filepath = 'e:\\' + filename + '.txt'
  3. print(filepath)
  4. f = open(filepath,'w')
  5. content = input('please enter the content [single \':w\'aa as save and quit]\n')

  6. while True:
  7.     file_line = input()   
  8.     if file_line !='\':w\'':
  9.         f.write('%s\n'% file_line)
  10.     else:
  11.         break
  12. f.close()
复制代码
请教各位,为什么跟小甲鱼老师的程序相同,但是第一行内容老师写不进去呢
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-9-4 15:19:47 | 显示全部楼层
本帖最后由 onfocus 于 2014-9-4 15:21 编辑

看第6行
  1. filename = input('please enter the file name: ')
  2. filepath = 'e:\\' + filename + '.txt'
  3. print(filepath)
  4. f = open(filepath,'w')
  5. content = input('please enter the content [single \':w\'aa as save and quit]\n')
  6. f.write('%s\n' % content)

  7. while True:
  8.     file_line = input()   
  9.     if file_line !='\':w\'':
  10.         f.write('%s\n'% file_line)
  11.     else:
  12.         break
  13. f.close()
复制代码





小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-9-4 15:36:10 | 显示全部楼层

ok   十分感谢    是自己不小心把上面的print写成了input了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-15 20:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表