Python includes exercises 98
Title: keyboard input from a string, all lowercase letters to uppercase letters, and then output to a disk file "test" to save.
Program Analysis: None.
Source Code:
#!/usr/bin/python # -*- coding: UTF-8 -*- 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()
The above example output is:
please input a string: w3big.com w3big.com