开发者

how to use the output/value of variable in python

I'm learning python. So here's what I'm after:

Inside a python script I have the following:

back_minutes1 = int(sys.argv[2])
back_minutes = timedelta(minutes=back_minutes)

This works fine, but I'm essentially creating a 'trash variable' to make it work. If this wer开发者_JAVA百科e say bash, I could probably do something like

back_minutes = timedelta(minutes=`int(sys.argv[2])`)

This, of course doesn't work. What's the pythonic way to do this without creating this throw-away variable?


Why not

back_minutes = timedelta(minutes=int(sys.argv[2]))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜