raw_input("Press enter to continue.")
print "loading a better article from article.json"
betterArticle = Article.fromFile("article.json")

raw_input("Press enter to continue.")
print "Showing the better article"
print "\n"
betterArticle.show()

raw_input("Press enter to continue.")
print "Changing the creator to random.random()"
betterArticle.creator = "{}".format(random.random())

raw_input("Press enter to continue.")
print "Showing the better article again, with new creator"
print("\n")
betterArticle.show()

raw_input("Press enter to continue.")
print "Saving the better article"
betterArticle.save("article.json")

raw_input("Press enter to continue.")
print "Creating a Picture"
prettyImage = Picture("beauty.jpg", "ya boy")

raw_input("Press enter to continue.")
print "Displaying Picture"
prettyImage.show()
Exemplo n.º 2
0
print
"""
print "==testing question 2=="
print "making article... ",
print
a = Article()
a.author = "James"
a.headline = "Testing"
a.content = "AaBaCcDdEe FfGgHhIiJj KkLlMmNnOo..."
a.show()

print "saving to test.txt..."
a.save("test.txt")

print "trying to load from a nonexistent file..."
a.load("fake.txt")

print "trying to load from test.txt..."
a.load("test.txt")

print "trying to load from new.txt..."
a.load("new.txt")
a.show()

print "creating a picture and displaying it..."
p = Picture()
p.creator = "Internet stock photos"
p.title = "Strange stock stock photo"
p.location = "stock.jpg"
p.show()