+ 8
How do I avoid starting all over after a mistake in python console?
Whenever I make a mistake in a line of code in python, it's like I just have to start all over. What do I have to do to avoid this? Again, is there a way to take my cursor to a place or point in the console and add or edit something? Thanks.
27 Antworten
+ 22
I always recommend PyCharm, especially for beginners - it is a bit heavy, but it does a lot of work for you - manages your modules, gives you hints and autocompletion as you type, etc.
How do you access the built-in editor, hmm... Python GUI?
http://www.tech-recipes.com/wp-content/uploads/2012/09/3.jpg
+ 14
The console enables you interactive way of coding, not appropriate if you plan to make a working program. You should create your work in an IDE, like Pycharm, use an external editor like Notepad++ or the default one embedded within your Python installation - IDLE. It has two window types - the shell, which you are probably using and the editor which is way better suited for programming.
+ 9
@Daniel For mobile there is QPython3 which has both a console and an editor. Plus, it contains several interesting code examples, including those utilizing the sl4a library (Python for Android).
+ 7
@Kuba; Right; yes. Maybe it's smaller now? I guess I sortof ignore it on my mobile & simply forget about it on my tablet.
Thanks for the reminder / perspective.
+ 6
Pls let me know if that helped :)
+ 6
@Kirk Thanks man, I have to try it then. I hear that people complain on DroidEdit, it seemingly has a banner overshadowing the screen in the free version. Is that true?
+ 5
@kuba If you mean: pip install -- it's fantastic... IMO because it's a standard linux shell, just like a PC (to shell in QPython (old) I had to trick the interpreter into crashing out).
I'm linking my 'fair comparison', written after many long days fixing+fighting QPython's package system... writing package maintainers... even wheels... until I found the unicode defect was known in that version.
I'll also try the new QPython version (just noticed!) as a potential breath of fresh air.
[[ Aside, credit because Python's package system is known to be tricky:
http://lucumr.pocoo.org/2014/1/27/python-on-wheels/ ]]
https://www.sololearn.com/discuss/244002/?ref=app
+ 4
@Kirk does it support free module install easily?
+ 4
If you develop on your Android device like I do, Termux is a free app that "enhances" the built-in Linux-ish terminal and no root is required, just a lot of space because of apt packages. I purchased the Termux:API (so I can easily copy & paste from the command line) as well as Termux:Float (so I can get a toggleable floating window overlay which allows me to switch quickly between info & code).
If you wanted a little more Linux on your Android, there it is.
If you do not know the difference between "bash" and the Windows Command Prompt, best stay away for now.
+ 3
@OP: in interactive Python you have to know what it remembers (everything up to the error), then arrow up and press enter on--in order, optionally editing--each line again as it appears. Not too much fun.
@Qpython3 users--is fine...I've just no longer been recommending it, even with its advantages. Last one I used had Unicode and pip problems... with confusing (duplicated) source trees and no apparent support.
Instead, I install Termux, 'apt install python', then use something like DroidEdit.
+ 3
Well I'm not sure in python but in Visual studio that I use for writing C# programs I use F11 to see how my program goes step by step.
I'm sure there is something similar in python too.
+ 2
Well there are alot of Editors that can help you code easier one of those are:
1.sublime Text
2.Notepad++
3.VIM
and many more
The first two are the most common by programmers
+ 2
how is my code...
https://code.sololearn.com/WrAZFA9YIxrB/?ref=app
+ 1
Thanks
Which IDE do you recommend? Also you talked about shell and editor, how do I access the editor?
+ 1
Usually using a script window to write the code is easier. You can then use incremental development, writing bit by bit to check each piece along the way
+ 1
Just use notepad to edit your script and then copy it to python console to run the script
If you are doing it often, I recommend you to use Jupyter Notebook, it allows you to edit and run python scripts interactively.
for more information about jupyter notebook:
http://jupyter.org/
+ 1
always comment every statement of your code so that it will be easy to debug
+ 1
Its super easy!! work first on your PC or an app and then write it down here
+ 1
practice make you better
+ 1
you can also use a python basical IDLE it's very practical