#!/usr/bin/python
#-*- coding:utf8 -*-
import sys
sys.stdout = open("Jack.txt", "w+")
print "Hello"
sys.stdout.close()
#创建文件并斜写入数据
#sys.stdin = open("test1.txt", "r")
#for line in sys.stdin.readlines():
# print line
#字符流转化为字节
def FileInputStream(filename):
try:
f = open(filename, "r")
for line in f:
for byte in line:
yield byte
except StopIteration, e:
f.close()
return
#字节转化为字符 并写入文件
def FileOutputStream(inputStream, filename):
try:
f = open(filename, "w")
while True:
byte = inputStream.next()
f.write(byte)
except StopIteration, e:
f.close()
return
FileOutputStream(FileInputStream("Jack.txt"),"Jack2.txt")
#-*- coding:utf8 -*-
import sys
sys.stdout = open("Jack.txt", "w+")
print "Hello"
sys.stdout.close()
#创建文件并斜写入数据
#sys.stdin = open("test1.txt", "r")
#for line in sys.stdin.readlines():
# print line
#字符流转化为字节
def FileInputStream(filename):
try:
f = open(filename, "r")
for line in f:
for byte in line:
yield byte
except StopIteration, e:
f.close()
return
#字节转化为字符 并写入文件
def FileOutputStream(inputStream, filename):
try:
f = open(filename, "w")
while True:
byte = inputStream.next()
f.write(byte)
except StopIteration, e:
f.close()
return
FileOutputStream(FileInputStream("Jack.txt"),"Jack2.txt")