擅长:python、mysql、java
<p>这样做,并确保列表中的最后一个字符串有一个<code>\n</code>,这样每当不同的用户在新行中输入信息时,该字符串就会出现:</p>
<pre><code>with open("file_name.txt", 'a') as f: # "a" is used to append data to a file that is it
# does not delete previously written data instead appends to it also f is the variable
# which stores the file and could be anything
for reservation in reservationList:
f.write(reservation)
print("done")
</code></pre>