时间:2021-07-01 10:21:17 帮助过:63人阅读
Python代码
#!/usr/bin/python print ord('a') print chr(97) #字符和整型互相转换 fp = open("file.tmp") for line in fp.readlines(): print line, #文件操作readlines()函数一次读入多行,循环输出 for line in fp: print line,
Python代码
#!/usr/bin/python import time #time模块使用 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代码
#!/usr/bin/python import sys print sys.platform print sys.argv[0] print sys.argv[1]