Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use input in directory search

Status
Not open for further replies.

rohankewl

Technical User
Jun 14, 2007
1
0
0
I'm using dircmp to compare two directories.
I need to take the input from the user and I will do that by using name=input()
but I'm not sure how to use the user input else where.

dircmp(/home/usa/ca/.../sj/bkb/current, /home/usa/ca/.../lx/bk/current)
I have to use the user input 'name' at the place where I have put dots, so please tell me how to use it there.
 
Hello,

You should be able to concatenate the name variable with the two halves of the respective strings. I am a relative new comer to the language but I believe this is how you would do what you want
Code:
name = input() // or use name=raw_input() if you need to have special characters in the user input

root = '/home/usa/ca/'
dir1 = root + name + 'sj/bkb/current'
dir1 = root + name + 'lx/bkb/current'

dircmp(dir1, dir2)

This is just a guess as I am at work and don't have a python interpreter to check the syntax.

Hope this helps.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top