text = [] for i in open("Add Your File path Here/Read-Text.php"): text.append(i) print(text) for i in range(len(text)): if text[i][-1] == '\n': text[i] = text[i][:-1] print(text)
|
Output:
[' \n', ' <?php include "../header.html" ?>\n', '<title>Python beginners - Program </title>\n', ' <meta property="og:title" content="Python beginners - Program " />\n', ' <meta name="description" content="Python for beginners. Learn Python with programming examples"/>\n', ' <meta property="og:description" content="Python for beginners. Learn Python with programming examples" />\n', '\n', ' <?php include "../header2.html" ?>\n', ' \n', '\n', '\n', ' <div class="row content-padd" style="font-size: 18px;">\n', '\t \n', ' \t<div class="left-column">\n', ' \t<div class="card">\n', ' \t
|