Python - Mehrere Zeilen Text in einen String packen
-
wie kann man mehrere Zeilen Text in einen String packen
header = ' <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="msapplication-task" content="name=Startseite Forum;action-uri=http://www.c-plusplus.net/forum;icon-uri=http://www.c-plusplus.net/user_group.ico"/> <meta name="msapplication-task" content="name=Unbeantwortete Beiträge;action-uri=http://www.c-plusplus.net/forum/newposts;icon-uri=http://www.c-plusplus.net/offline_user.ico"/> <meta name="msapplication-task" content="name=Eigene Beiträge;action-uri=http://www.c-plusplus.net/forum/egosearch;icon-uri=http://www.c-plusplus.net/edit_user.ico"/> <meta name="msapplication-task" content="name=Follow me!;action-uri=http://twitter.com/cplusplusde;icon-uri=http://www.c-plusplus.net/Hungry-bird.ico"/> <meta property="fb:page_id" content="116155165079495" /> <title>C/C++ Forum :: Neues Thema schreiben</title> <link rel="stylesheet" href="templates/fisubtext/fisubtext.css" media="screen, projection" type="text/css" /> <link rel="stylesheet" href="templates/fisubtext/print.css" media="print" type="text/css" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/> <link rel="author" title="Impressum" href="../cms/modules.php?op=modload&name=legal&file=index"/> <link rel="search" title="Suche" href="search"/> <link rel="copyright" title="Urheberrecht" href="../cms/modules.php?op=modload&name=legal&file=index"/> <link rel="top" title="c++.de" href="../cms/index.php"/> <script src="templates/fisubtext/misc.js" language="javascript" type="text/javascript"></script> <script src="templates/fisubtext/rsscache.js" language="javascript" type="text/javascript"></script> <script type="text/x-mathjax-config"> '
Ich möchte das machen um einen HTML Generator zu schreiben
etwa so:def GenerateWebsite():
filename = "test.html"
# Create a file object:
# in "write" mode
FILE = open(filename,"w")# Write all the lines at once:
FILE.writelines(header)GenerateWebsite()
def GenerateWebsite(): filename = "test.html" # Create a file object: # in "write" mode FILE = open(filename,"w") # Write all the lines at once: FILE.writelines(header) GenerateWebsite()
Gibt es das eine einfach Lösung?
-
header = """ ... ,,, """