Changes

Jump to: navigation, search

OPS435 Python Lab 5

10 bytes removed, 09:49, 5 September 2017
PART 2 - Writing To Files
f.write('Last line in file\n')
f.close()
cat file1.txt</source><br>The final point to make when writing to files is to make certain that the values being written are '''strings'''. This means that before trying to place integers, floats, lists, or dictionaries into a file, first either convert the value using '''str()''' function or extract the specific strings from items in the list.<br><br></li>
<li>To see how to convert numbers into strings to be stored into a file, issue the following commands:<source lang="python">
my_number = 1000
13,420
edits

Navigation menu