print('Bem-vindo!')
print()
numero_contas = int(input('Deseja registrar quantas contas: '))
x = 0
while x < numero_contas:
x = x + 1
conta = str(input('A conta é de qual site:'))
print()
usuário = str(input('Digite o usuário:'))
senha = str(input('Digite a senha: '))
print()
arq = open('Contas.txt', 'w')
arq.write(conta)
arq.write('\n')
arq.write('Usuário: {}'.format(usuário))
arq.write('\n')
arq.write('Senha: {}'.format(senha))
arq.write('\n')
arq.close()
The problem is this: if for example, I type 2 in the variable "account", it asks for the information normally, but when I open the file to verify, it only registers the first account, if I type 3 in variable "account", it only records the second account, so on.
How can I solve this problem?
One more basic question, how can I make sure that the program, whenever it is executed, does not take away the previous records? For example: I ran the program, I registered only one account. Then I run the program again, and register two accounts, then when I go to check, the data from the first run is gone, it only left the second run data registered. And I want it to register all the data, without deleting the data from the previous executions, I want it to join with the next executions.