Skip to content Skip to sidebar Skip to footer

How To Use Python .format() Appropriately?

Given the following: user_ = socket.gethostname() runtime_ = time.ctime() game_days = 'season open' variable = 'speed' start_time = datetime.time(15, 0) weekdays = 'all days' p

Solution 1:

s = '{}, {}, US/Central - {}\nVariable: {}, At: {}. {} {}:{}\n--------------------------------------------------------'

tag = s.format(user_, runtime_ game_days, variable, str(start_time)[:-3], weekdays, period[0],period[1])

That is a remarkably thorough tutorial you linked, I didn't know some of that. What was it specifically you were struggling with?


Post a Comment for "How To Use Python .format() Appropriately?"