Python saving and replacing (help)

0 Denis Balaj · September 15, 2015
Hello guys,

Im trying to do something, but i failed, and failed.
So i will try to explain you with examples:

If i make a list like and inputs:
addSomething = input("Enter something to add in the list: ")
myList = [addSomething]

And run this, how can a list like this be replaced and saved in the code.
I tried but even i input something, code stays how it was and no replacing, and no new values.
How can this be replaced and saved? hope you understand.
I tried with replace() but it doesnt work.

Post a Reply

Replies

Oldest  Newest  Rating
0 Bernard Pyc0d333 Parah · September 20, 2015
dude was working with a file. you need to be clearer with your questions
0 Halcyon Abraham Ramirez · September 20, 2015
dude be clearer on your questions man so we can help better. anyway good on you!
0 Denis Balaj · September 19, 2015
I solved this problem just use open() and first use mode w, second a :)
0 Denis Balaj · September 18, 2015
nope nope and nope, no one works, i solved this! i used open() with r+ mode
0 Bernard Pyc0d333 Parah · September 18, 2015
.append() it is
+2 Halcyon Abraham Ramirez · September 15, 2015
what exactly do you want?

you'll make a list and you'll add some things to the list?



lists = []
add_to_list = ""
print(" put what you want to add to the list if done type 'stop'")
while add_to_list != "stop":
    add_to_list = input()
    lists.append(add_to_list)

print(lists)
  • 1

Python

107,085 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator