pythonExample100/JCP098.py

16 lines
396 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

'''
【程序98】
题目从键盘输入一个字符串将小写字母全部转换成大写字母然后输出到一个磁盘文件“test”中保存。
   输入的字符串以!结束。
1.程序分析:
2.程序源代码:
'''
if __name__ == '__main__':
fp = open('test.txt','w')
string = raw_input('please input a string:\n')
string = string.upper()
fp.write(string)
fp = open('test.txt','r')
print fp.read()
fp.close()