Python chapter summarizes the function [output] function

1、 raw_input("\n\nPress the enter key to exit.")
In the above code, "\ n \ n" before the result output two outputs new blank line. Once the user presses Enter (Enter) key to exit, the other key display. raw_input prompt the user to enter data
 
2, Python may be used in the same row multiple statements, statements using a semicolon (;) is divided, the following is a simple example: Import SYS; X = 'runoob'; sys.stdout.write (X + '\ n ')
Execution code above, enter the result of:
$ python test.py runoob
 
3, the output information
counter = 100 # assign an integer variable miles = 1000.0 # floating point type name = "John" # string print counter print miles print name
# Use the built-in function to traverse enumerate
#for index, item in enumerate(sequence):
# process(index, item)
sequence = [12, 34, 34, 23, 45, 76, 89]
 
for i, j in enumerate(sequence):
print i,j

Guess you like

Origin www.cnblogs.com/TomBombadil/p/10979597.html