Python reads files and timesys modules. the usage of some standard library functions is also to be learned, such as osresetsstringqueuesocket #! Usrbinpythonprintord (a) printchr (97) # Convert the characters and integers into fpopen (& amp; quot; file. tmp & amp; quot;) forlineinfp. readlines (... simple use of python to read files and the time/sys module
Usage of some standard library functions is also to be learned, such as: OS/re/sets/string/queue/socket
Python code
#! /Usr/bin/python print ord ('A') print chr (97) # Conversion between characters and integers fp = open ("file. tmp ") for line in fp. readlines (): print line, # The File operation readlines () function reads multiple rows at a time, and cyclically outputs for line in fp: print line,
Python code
#! /Usr/bin/python import time # time module uses print time. localtime (). tm_year # time. struct_time (tm_year/tm_mon/tm_mday/tm_hour/tm_min/tm_sec/# tm_wday/tm_yday/tm_isdst) print time. asctime () # time () localtime () gmtime () ctime () strftime () strptime () # clock () sleep ()
Python code
#!/usr/bin/python import sys print sys.platform print sys.argv[0] print sys.argv[1]