0
處理我的代碼我發現了一個與我的項目功能有關的問題:代碼預覽。 我打開一個包含代碼的文件,讀取所有包含行的數組。HTML中沒有空格
這是代碼: Main.py
with open(path.join(files_folder, prj + '.' + file_ext)) as file:
lines = file.readlines()
然後,我使用HTML變量行: 的index.html
<ol>
{% for line in lines %}
<li>{{ line }}</li>
{% endfor %}
</ol>
裏面的文件代碼:
while True:
if 10 > 8:
print('Hello World!')
問題是,在Main.py文件中使用print(行),它打印出l ines和空格,但是當我在HTML上打印時,沒有空格。
P.S.我也嘗試打印只是行,但它是相等的行打印
謝謝! @ wander-nauta你已經解決了我的問題! :d –