Today is the first day to learn python.
To install Python:
It's easy to install Python. Download the python2.7 version on the https://www.python.org/website and install it directly, all the way to next. The default installation path for Python is under the C:python27 folder.
Say less nonsense:
Python's first HelloWorld application:
print'helloworld! '
How Python directly outputs output variables will also output
' Hello world!! '>>>name
This will also output the Hello world!! However, the output from the print statement is not exactly the same as the print output: helloworld!! But the latter output is: ' Hello world!! '. The difference is because print calls the STR () function to display the object, and the variable is the call to the REPR () function to display the object.
Now note the PRINT statement:
Print ' %d is a number and%s is a string' % (1,'1')
This is how Python formats the output string.
It's the same as the programming language we know.%d represents an integer,%s represents a string, and%f represents a floating-point type.
Application of the ' >> ' symbol in the Python print statement:>> used to redirect output
LogFile = open ('e:/python/hellowrold.py','a') Print >> logfile,'some text'logfile.close ()
The text of the some text can be added to the helloworld.py file in the Python folder under the E: Disk. Where >> is used to redirect output.
Python's raw_input function: He reads the standard input and saves the read input to the specified variable.
Username = raw_input ('Enter your name:')
Executing such a statement will require the user to enter and save the input in username.
If you want to convert the input to int, you can use the Int () function.
One hour Python per day (10.09)