美文网首页python学习笔记
python练手_98-磁盘写入II

python练手_98-磁盘写入II

作者: 学子CH | 来源:发表于2019-02-23 11:22 被阅读0次
# -*- coding:utf-8 -*-
# @Author: CH
"""
@project: python study
@time:2019/1/9-20:23
@file_name:【程序98】磁盘写入II.py
@IDE:PyCharm 
@else: DO NOT STOP STUDYING!!!
"""
# 题目 从键盘输入一些字符,逐个把它们写到磁盘文件上,直到输入一个 # 为止。
#程序分析 无。
if __name__ == '__main__':
    fp = open('test.txt','w')
    string = input('please input a string:\n')
    string = string.upper()
    fp.write(string)
    fp = open('test.txt','r')
    print (fp.read())
    fp.close()

相关文章

网友评论

    本文标题:python练手_98-磁盘写入II

    本文链接:https://www.haomeiwen.com/subject/afzmeqtx.html