#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from sys import stdout filename = input('输入文件名: ') fp = open(filename,"w") ch = input('输入字符串: ') while ch != '#': fp.write(ch) stdout.write(ch) ch = raw_input('') fp.close()
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': from sys import stdout filename = input('输入文件名: ') fp = open(filename,"w") ch = input('输入字符串: ') while ch != '#': fp.write(ch) stdout.write(ch) ch = raw_input('') fp.close()