list index out of Range

Started by
12 comments, last by koka282 9 years, 8 months ago

Lysy

sry what should i do to ask !?

Simple 'Hi, I got a little problem here, can you help me?', then explain problem in few words, attach screens and code if needed.

Also, to be honest, as much as I want to help you, I just cannot go through posts with almost none punctuation, and forms like 'u' instead od 'you'.

You're learning Python, you should already know that readability matters!

Enough with this offtopic.

Advertisement

ok sry :)

pls help sad.png

BeerNutts

i tried like what u say before

but i want to know

i should see :

Copying from test.txt to new_file.txt
The input file is 21 bytes long
Does the output file exist? False
Ready, hit RETURN to continue, CTRL-C to abort.

Alright, all done.

when i try to write anything in Ex1.txt i see : error not defined

i try to write anything but as string i put " "
and i see that !! :'( :

like the pic nothing happened sad.png
ggg.png

Ty all for helping me smile.png

Ok so in the code that you posted you are now trying to set three variables from only two:

script, from_file, to_file = argv[0], argv[1]

is not correct. You had it correct with your original post.

You need to call the script like:

python BoB.txt from.txt to.txt

(Side note, your python files should end in .py and not .txt!).

Notice there there are not one, but two arguments there. argv[1] contains the first argument you passed ("from.txt"), and argv[2] contains the second ("to.txt").

The course I listed is both free an interactive. If you are having these sorts of problems then perhaps the course I mentioned will help you and then you can go back to learning python the hard way after that.

I also recommend a better Python IDE like I mentioned. The one I listed has code completion but more importantly PEP syntax checking to help you find errors/unused variables in your programs and a built in debugger.

[attachment=23208:yourcode_in_pycharm.jpg]

shadowisadog

Thank you bro smile.png

V1kOe9Gq.png

i read something wrong so i i take long time to understand sad.png

i understood something wrong

Sry for hard understanding sad.png sad.png sad.png

This topic is closed to new replies.

Advertisement