How can i use raw_input and string formatting % or %d python

前端 未结 3 869
Happy的楠姐
Happy的楠姐 2021-01-26 11:26

i have variable var, and it is changeable how can i use raw_input and inside raw_input make a question and use this variable i.e.

z = raw_input(\"Is         


        
3条回答
  •  失恋的感觉
    2021-01-26 11:45

    With raw_input, %var should also lie within the parentheses. i.e:

    z = raw_input("Is your age %d" % var)
    

提交回复
热议问题