python to guess specific path? -


i working on script information skype database. got following code:

con = sqlite3.connect('c:\\users\\joey\\appdata\\roaming\\skype\\jre93\\main.db') 

but skype id (jre93) , user (joey) of computer different. there way python can recognize path automatic out user input?

usually folder name of skype id contains main.db file! can use fact skype id.

one method first check if there skype folder @ particular path. find folder in skype folder, contains main.db file. if folder found name of folder skype id.

i have created small quick , dirty script work. (it can further improved)

code:

import getpass import os import sys  username = getpass.getuser() #get username path = "c:\\users\\"+username+"\\appdata\\roaming\\skype\\"  if (os.path.isdir(path)) == true: #check if skype folder exists     subdirectories = os.listdir(path)     in subdirectories:         if os.path.isdir(path+i) == true:             if os.path.exists(path+i+"\\main.db"):                 print ("skype id %s") %i  else:     print 'skype folder not exists' 

i hope helpful.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -