python - Extend string to a list inside a list -


list = [ [ ] ] money = int(raw_input("enter total money spent: ")) 

in program want extend money variable list inside list, when print it, appears [ ["money variable input"] ]. planning on adding other items same element. how can this? thanks.

just use "append" method on first element of list. since list multi-dimensional array, first element array, have "append" method. example:

list = [ [ ] ] money = 10 list[0].append(money) list 

prints [[10]]


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -