问题
I've been googling lots and this is getting really frustrating. It doesn't act like idle.
Example:
else:
name = 'World'
print 'Howdy', name
print 'yay'
but in Notepad++
else: # i press enter and this is what it does
lands me here
But I want to be able to do like in idle: after the :
I can just press enter and keep on going. My English isn't that great.
I have my filetype set to Python etc. and my format to unix.
回答1:
This is what you want:
Settings > Preferences > MISC. > Auto-Indent (checkbox)
--
Sometimes people ask, "How can I do x in program y?"
I have a dream that one day "Use program z instead" will not be the most popular response.
回答2:
I played a bit with python in Notepad++ and I had a problem with the tab. Since in python your indentation is really important but notepad ++ put space instead of a tab.
So to change to tab you need to go in notepad ++ Menu Settings > Preferences... then select Tab Settings Then select python in the Tab Settings box and uncheck Use default value and check Replace by space.
Like the other answer, you might want to consider another ide. I personally use eclipse with the pydev plugin and django plungin. Erik is nice too.
回答3:
I found the Python Indent plugin on the official plugin page, and it worked fine!
http://docs.notepad-plus-plus.org/index.php/Plugin_Central#P
回答4:
Well, here is a updated answer:
Notepad++ >> Plugins >> plugin manager >> show plugin manager >> find (python indent) click install >> should be downloaded you need to reach to enable again from Plugins>>python indent>>enable
回答5:
Go to Settings > Preferences > Language
Then on the "Tab Settings" box select "python" and tick the "Use default value" checkbox.
You're welcome.
P.S. Yeah, I know this a little old. I really just couldn't help it. Anyway, this is for version v7.3.2.
回答6:
- Click on Settings
- Click Preferences...
- Browse drop-down menu to find MISC.
- Tick the box which says Auto-indent
After that, you should be fine.
回答7:
A better ide might be spyder. http://code.google.com/p/spyderlib/ its about the best IDE I have found.
回答8:
Geany is a fast and light-weight cross-platform IDE, it supports auto-completion and auto-identation for python code, execute run your program , integrated console , plus has a symbol list side pannel that lets you visualize and browse you code easily, you can jump directly to function definitions and the likes using the context menu, plus it's open source
How ever for a full fledged IDE i would recommand Eric4
回答9:
I've found Notepad++ to live up to the task of being a better basic text editor than Notepad, but it isn't really designed to be as smart as a proper programming IDE.
It might be possible to get it to do what you're asking for, but I certainly don't know how to set it up that way.
回答10:
Emacs has python-mode which (also) does it. Grab it and prepare for life-time enjoyment.
来源:https://stackoverflow.com/questions/5532549/automatic-indentation-for-python-in-notepad