2021年1月29日星期五

get input from user and pass it is parameter to a function

Team,

I need to request user to speficy a filename then pass that as parameter to called function but am getting syntax. am new to python please bear me..

import os  import subprocess  dirpath = os.environ.get('HOME')/backup/"  def stuckPodinfo(filename)      filepath = dirpath/filename      subprocess.run(["cat", "filepath"], capture_output=True)    stuckPodinfo(filename=input('Enter name of a file that is under dirpath: '))    

output

  File "/Users/test/code/external/python-dev/stuckPodinfo.py", line 5      def stuckPodinfo(filename)  
https://stackoverflow.com/questions/65963667/get-input-from-user-and-pass-it-is-parameter-to-a-function January 30, 2021 at 09:05AM

没有评论:

发表评论