Beispiel #1
0
from blog_post import BlogPost
from blog import Blog

blog = Blog()
blog_post_1 = BlogPost('Orsi', 'első', 'első', 'ma')
blog_post_2 = BlogPost('Geri', 'második', 'második', 'ma')
blog_post_3 = BlogPost('Ibi', 'harmadik', 'harmadik', 'ma')
blog.add(blog_post_1)
blog.add(blog_post_2)
blog.add(blog_post_3)
# print(blog)
# print(blog_post_2.cime)
blog_post_4 = BlogPost('Jozsi', 'negyedik', 'negyedik', 'ma')
blog.add(blog_post_4)
# print(len(blog.blog_posts))
# print(blog.blog_posts[3].cime)
# print(len(blog.blog_posts))
# blog.delete(4)
# print(len(blog.blog_posts))

blog.switch(blog_post_1, 4)
print(blog.blog_posts[0].cime)
Beispiel #2
0
from blog_post import Blog_post
from blog import Blog

blog1 = Blog_post("John Doe", "Lorem Ipsum", "Lorem ipsum dolor sit amet.",
                  "2000.05.04.")

blog2 = Blog_post(
    "Tim Urban", "Wait but why",
    "A popular long-form, stick-figure-illustrated blog about almost everything.",
    "2010.10.10.")

blog3 = Blog_post(
    "William Turton", "One Engineer Is Trying to Get IBM to Reckon With Trump",
    "Daniel Hanley, a cybersecurity engineer at IBM, doesn’t want to be the center of attention. When I asked to take his picture outside one of IBM’s New York City offices, he told me that he wasn’t really into the whole organizer profile thing.",
    "2017.03.28.")

blog = Blog()

blog.add(blog1)
blog.add(blog2)
blog.add(blog3)

print(len(blog.blog_posts))

blog.delete(2)

print(len(blog.blog_posts))
print(repr(blog.blog_posts))
Beispiel #3
0
from blog import Blog
from blogPost import BlogPost

my_blog = Blog()
print(my_blog.posts)  # []

cikk1 = BlogPost("EAP", "Cím", "content", "2020.04.24.")
my_blog.add(cikk1)
cikk2 = BlogPost("Jakab", "Clickbait", "szöveg", "2020.03.12.")
my_blog.add(cikk2)

my_blog.listBlogPosts()

my_blog.removeByIndex(0)  # törli cikk1-et
my_blog.listBlogPosts()

my_blog.updateByIndex(0, cikk1)  # cikk1-re a megmaradt cikk2-t
my_blog.listBlogPosts()