Sep-24-2018, 03:08 PM
(Sep-24-2018, 02:32 PM)cygnus_X1 Wrote: time ="14:00"
content = os.popen("sed -n '/time/, +3p' mon").read()
It would be a crazy world indeed, if all your variables were just injected into strings. You need to specifically let python know in some way that you expect interpolation to be taking place:
>>> time = "14:00" >>> "spam /time/ eggs" 'spam /time/ eggs' >>> "spam /{0}/ eggs".format(time) 'spam /14:00/ eggs' >>> f"spam /{time}/ eggs" 'spam /14:00/ eggs'