Python Learning Notes (-windows) and the path and file __mysql under Linux

Source: Internet
Author: User
The concept of a path file

The document is good to understand, for example the a.txt under D disk is a file.

The path refers to the location of the file on the operating system, such as the D disk, which indicates a location, that is, the path. two, Windows and Linux for different processing of the path

Like two programmers, the habit of writing the program is different, two operating systems on the path of the rules are not the same.

Windows is using \, and Linux is using the/,windows root directory is the disk character C:\, and the Linux root directory is/

For example

C:\a.txt
/mnt/a.txt
Third, string expression of file path

Linux is very well understood, just add single or double quotes

"/mnt/a.txt"
'/mnt/a.txt '

Because the \ is an escape character used in Windows, you can use \ to express a \ 's true meaning in a string.

"C:\\a.txt" "
C:\a.txt"
Four, absolute path and relative path

The so-called absolute path, refers to the path from the root directory.

The so-called relative path, refers to the current working directory, the current working directory refers to the program locked in the directory.

For the current directory. Represents the parent directory.

Like what:

program file: C:\temp\a.py
a.txt indicates that C:\temp\a.txt
. \a.txt represents C:\temp\a.txt
. \a.txt says C:\a.txt
. \tt\a.txt says C:\\tt\a.txt

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.