Self-learning Python, now there is a situation, what should I do?

Source: Internet
Author: User
Tags python script sublime text virtualenv

Reply content:

You are using the self-brought idle ... A wonderful editor = =

In theory, this error is the Python VM crashes after the port is not released, you can use Command+space input terminal, and then Ps-ef | grep python looks like this to see if there is an unfinished process, so just kill it. The worst, restart the machine must be good.
Learn python, it is best not to idle, on the IDE, more pycharm,wingide, Big head of the Pydev+eclipse is also a good choice, I personally recommend it, early you learn python, first in the system loaded a Easy_ Install and homebrew, the former is responsible for Python package, the latter is responsible for the system package, after the installation of Pip, Ipython on the line, and then directly with the Ipython interactive environment to learn, with vim/sbt2 such an editor to write scripts. Yes, remember to set space=4 so that the tab indentation should be burnt to death lol

Of course, in a sense I personally do not quite recommend the use of Independent editor ... Because the platform engineers are always faced with the first phase of the character interface Tat,python is actually very good, in the interactive environment, then you have to learn the package management/compilation chain (python many C extension) and virtualenv, With these 3 kind of basic can be handy to write a Python small script look, if go web development, PEP333 WSGI protocol What, then understand the Tcp/http protocol layer, gunicorn/gevent such server, you can cast resume to do program ape =

===================, my new split line from Weibo ===========================.
=_= because I answered the question when thought that the road landlord @stephanie Yu is still in the beginning of the university young man, until I read the micro-blog after a sword in the knee ... Well, I'll give you a simple program to learn python.

First of all, each Apple machine with a call terminal, you can find this in the Finder (Command+space search), open it, of course, it is ugly, very discordant, but enough, open and then enter Python into the Python interactive interface, Depending on your system version, the Python version you are using should be the 2.7.X series.

Then, you can enter the python sentence in this interface to learn, the simplest manual reference to the concise Python tutorial of Uncle Mushroom , of course, your English should be enough to see the original, then a learning Python (watercress) is the only choice for you to get started (the Chinese version of this goods is Spit xiang).

Then you must write a script to run the requirements, such as the landlord you most want the bulk of the script, this time you need an editor to do this thing, the simplest of the next Chocolat‹text editor for Mac , set the indentation to 4 spaces and file type can write scripts, I do not recommend the new SB2 or VIM, high-level editor learning costs too much.

How the script works, you need to save the script in a location, such as the desktop, switch your terminal path to the desktop, such as input CD ~/desktop, and then the Python script name. PY, you can see the output.

Tips
    1. Novice's words are not recommended to use PDB debugging, if the program error, will tell you in which line error why error, directly with print debugging.
    2. Python's thing encoding is absolutely hell, novice is the most easy to encounter is the Chinese string processing problem, so brave in each of your script files at the top of the Add #coding:utf-8 bar.
    3. A good coding style is helpful for debug, at least not for newcomers, who are not confused about the nature of the process, and the only way to accomplish one thing in Python (Ruby should be burned!). ), see Pep 8-Style Guide for Python Code will be a lot of inspiration.
    4. In fact, I still want to say no virtualenv and package management of Python really can not use Ah, how to compile the chain management environment isolation to understand that will make your program run more cool on your system will not cause "pollution."
Your current situation is like, someone taught you to write a novel, first let you open a Notepad under Windows, and then create a new article, the result is a notepad error, so you can not continue to learn to write a novel ... But you can actually use any text editor to learn how to write a novel, right?

Similarly, you can use any text editor to edit. py files, not necessarily idle. You save the edited file as a. py and then enter Python in the terninal <文件名> . py to see the results of the run.

In fact, the only reason for you to use the idle on the tutorial is that the idle is Python's own, eliminating the hassle of asking you to find another editor.

However, as far as practical use is concerned, except for beginners, almost no one will use idle to write code, because it is not very good.

The above-mentioned vim and the like are all editors, but those are too hard to send, it is not suitable for beginners. I recommend an editor sublime Text , you don't even have to run to terninal to play Python, so you can see the results directly cmd+b.

Wish you a happy learning python.

Division line = = = = =

In order to study what you said is not responding after the new window, I deliberately tried on the Mac, did not find anything amiss.

I saw you say, "I'm going to make a mistake," and I guess that's what's wrong with it, but it's hard to judge because I don't know what it is.

What's the problem, can I have a private messages. http://www. codecademy.com
The learning experience of this site is great for anyone without a foundation for computers and programming.
Interesting, not boring, there are hints, there is a question and answer questions.

Access to Programming World English is a must-have skill, at least read. This is an English site, you can learn two at the same time. The Mac comes with Python, but that version of Idle often has an inexplicable problem.
Recommended Use:
    • Pycharm a Python integrated development environment, its user experience is quite handy. In addition to the general Editor's support for code checking, completion, folding, debugging, and so on, it is well-positioned to support the development of the Python web framework such as Django and Gae. can be customized and extensible. Support Windows, MAC, Linux platforms. The only drawback for beginners is that it is a paid-for software that has a 30-day trial period. If you want to use it as a helper for your work, it's still worth the start.
    • With Sublime text 21 Advanced text Editor, you can become a Python development tool by installing several expansion packs. You can associate the runtime environment of Python. The default has good code highlighting and indentation capabilities. Through the configuration, you can also increase the syntax check, format check, auto-complement function.
    • The legendary "God's Editor" Emacs and "Editor's God" Vim. Their common feature is strong scalability. In theory, you can use it to do whatever the IDE can do, and tune your favorite weapon to your liking. Unfortunately, this tool is more difficult to get started, not suitable for beginners.
Welcome to our classroom to discuss the problems encountered in the process of learning Python
/ http crossin.me
: Crossincode
QQ Group: 295921816 that's called Idle.

I'm glad you have a mind to learn python. I only used the win on the idle, open after the idle interface, and then create new window should be a new file, write directly. Save Press F5 to run.

I think the complete novice with the idle very good, this thing is originally designed for such a crowd. http://www. compileonline.com
It's a lot easier with this. 0, you can write Python without idle , with any text editor Yes, recommended sublime Text (Vim A text editor that is essentially the same as Notepad , but with the syntax awareness of the program code, the ability to display the language , built in some shortcut keys, etc., but vim learning curve is steep, not suitable for beginners).
1, find a book that is reliable!
Python Learning Handbook (watercress)
Your question can be seen in Chapter 3rd: How to Run a program
Come on! I rub, 0 basics and learn python, and it's on Mac.
This happens when you reinstall the test. The point is we can't help you.
It is recommended that you take this book as your supplementary study material. / http M.douban.com/book/revie w/5023550/?id=5363753&session=b26e43c2 Is the puzzle of the editor or the confusion of the IDE.
I don't know what's good if I like the IDE.
I recommend vim if you like the editor
Because Python doesn't need anything.
Just control the indentation just fine.
A Notepad or something is also available.
Use the editor you are more familiar with. Learning or lightweight tasks recommend the use of Ipython notebook.

Benefits:
1. The interface is like a webpage, unlike terminal, which makes beginners feel uncomfortable.
2. Support syntax highlighting, automatic indentation, beautiful layout.
3. The editing command is familiar with the common people, such as Command+c is a copy, Command+v is paste, command+x is cut, command+z is Undo, Command+y is redo, not like VI or Emacs so that beginners discomfort.
4. The source code is mixed with the document, writing the program like writing an article.
5. Interactivity is very good. You can draw pictures, display videos, enter mathematical formulas, and so on with a little bit of setup.
6. Many cattle people use this, because it is too convenient.

Start method:
1. Command+space
2. Enter terminal and then enter. In addition, terminal can also be found in the launchpad utilities, not necessarily command+space.
3. Enter Ipython notebook carriage return in terminal, then automatically open the Internet browser
4. Click "New Notebook" on the page that appears in the browser, and a new page will appear.
5. In this new page, there are some input boxes, just enter any python can recognize the command or program code, press shift+ Enter, you will see the results. For example, enter a 2, and then press Shift+enter.
6. Only a few times can be used skillfully.

Exit Method:
Save it in the menu and close it like a Web page. Then there may be something running in the terminal, the mouse click in the terminal window after clicking Control+c (not Command+c), and then confirm that you can exit that thing. Then click "X" to close the terminal.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.