Minor Documentation changes for code samples

Change-Id: I2d13fe2884d9eaebd112d342041e2e219bf6a240
This commit is contained in:
Jerry George 2015-07-30 14:41:41 -04:00
parent 44c9a4d512
commit 00082e5b42

View File

@ -83,14 +83,16 @@ commandline arguments, etc.) should be presumed to be encoded as utf-8.
WRONG: WRONG:
infile = open('testfile', 'r')
mystring = infile.readline() mystring = infile.readline()
myreturnstring = do_some_magic_with(mystring) myreturnstring = do_some_magic_with(mystring)
outfile.write(myreturnstring) outfile.write(myreturnstring)
RIGHT: RIGHT:
infile = open('testfile', 'r')
mystring = infile.readline() mystring = infile.readline()
mytext = s.decode('utf-8') mytext = mystring.decode('utf-8')
returntext = do_some_magic_with(mytext) returntext = do_some_magic_with(mytext)
returnstring = returntext.encode('utf-8') returnstring = returntext.encode('utf-8')
outfile.write(returnstring) outfile.write(returnstring)