Python Examples

The following are 3 code examples for showing how to use These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module time , or try the search function .

Example 1
Project: rpi_ai   Author: schollz   File:    License: MIT License 6 votes vote down vote up
def saveImage():
	time =
	filenameFull = config.filepath + config.filenamePrefix + "-%04d%02d%02d%02d%02d%02d" % (time.year, time.month,, time.hour, time.minute, time.second)+ "." + config.fileType
	# save onto webserver
	filename = "/var/www/temp.jpg""sudo raspistill -w "+ str(config.saveWidth) +" -h "+ str(config.saveHeight) + " -t 1 -n -vf -e " + config.fileType + " -q 15 -o %s" % filename, shell=True)
	print "Captured image: %s" % filename

	theSpeech = recognizeFace(filename,filenameFull)
	if len(theSpeech)>2:
		print theSpeech
		config.lookForFaces = 0

# Keep free space above given level 
Example 2
def get_date():
    This creates a string of the day, hour, minute and second
    I use this to make folder names unique
    For the files themselves, I generate genuinely unique names (i.e. name001.csv, name002.csv, etc.)
    time =
    time_str = "{}y{}m{}d{}h{}m{}s".format(time.year,time.month,,time.hour,time.minute,time.second)
Example 3
Project: piecewisecrf   Author: Vaan5   File:    License: MIT License 5 votes vote down vote up
def get_time_string():

    Returns current time in day_month_HH-MM-SS/ format

    time =
    name = (str( + '_' + str(time.month) + '_%02d' % time.hour +
            '-%02d' % time.minute + '-%02d' % time.second + '/')
    return name