Stupid way to learn python (0)

Source: Internet
Author: User

PY walk up!!!

Windows platform

1. Open http://learnpythonthehardway.org/exercise0.html in your browser to download and install the Gedit text editor. This operation does not require administrator privileges.

2. Put the gedit on the desktop or the Quick Launch bar so you can easily access the program. These two items can be seen in the installation options.

A. To run gedit, we need to get rid of some stupid default settings first.

B. Open Preferences from Gedit menu and select the Editor page.

C. Change Tab width: to 4.

D. Select (Confirm that the option is checked) Insert spaces instead of tabs.

E. Then open the "Automatic indentation" option.

F. Go to the View page and open the "Display line numbers" option.

3. Run the PowerShell program from the Start menu. You can use the Start menu search function, enter the name and hit enter to open.

4. Create a shortcut for it and put it on the desktop or in the Quick Launch bar for easy access.

5. Run the Terminal program, this program does not look very much.

6. Run python inside the Terminal program. The way to run it is to enter the name of the program and then hit enter.

A. If you run Python and find it does not exist (the system cannot find Python and so on). You need to access http://python.org/download and install Python.

B. Confirm that you are installing Python 2 instead of Python 3.

C. You can also try ActiveState Python, especially if you don't have administrator privileges.

D. If you install but Python is still not recognized, then you need to enter and execute the following command under PowerShell:

[Environment]::setenvironmentvariable ("Path", "$env:P Ath; C:\Python27 "," User ")

E. Close and restart PowerShell to confirm that Python is now ready to run. If not, you may need to restart your computer.

7. Type Ctrl-z (^z), and then hit enter to exit Python.

8. Then you should go back to the cue screen before you hit Python. If not, study why.

9. Learn to use Terminal to create a directory where you can search the Internet for what to do.

10. Learn to use Terminal to enter a directory. You can also search the Internet.

11. Use your editor to create a file in the directory you entered. You will create a file that uses the "save" or "Save as ..." option, and then select this directory.

12. Use the keyboard to switch back to the Terminal window, if you do not know how to use the keyboard switch, you can search the Internet.

13. Go back to Terminal and see if you can use the command to see your newly created file, Internet search How to list the contents of the folder.

Warning Sometimes you'll miss out on this step:

Windows has Python but no path is configured correctly. Confirm that you entered [environment]::setenvironmentvariable] under PowerShell ("Path", "$env:P Ath; C:\Python27 "," User "). You may need to restart PowerShell or your computer for the path setting to take effect.

In cmd > dir/ad view all subfolders while in PowerShell enter > Dir |? {$_.mode-like "d*"}

New-item is a simple and fast way to create new files and folders in PowerShell.

For example, create a new directory called AAA under the current folder > New-item aaa-type directory

Create a new file named Aaa.txt under the current folder > New-item aaa.txt-type

If the input item already exists, you can use the-force parameter (the original file will be updated all, the empty file), or you can use the-value parameter to add some parameters in.

For example, update the existing aaa.txt and enter this is a book > New-item aaa.txt-type file-force-value

Stupid way to learn python (0)

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.