How can I extract the folder path from file path in Python?

You were almost there with your use of the split function. You just needed to join the strings, like follows. >>> import os >>> ‘\\’.join(existGDBPath.split(‘\\’)[0:-1]) ‘T:\\Data\\DBDesign’ Although, I would recommend using the os.path.dirname function to do this, you just need to pass the string, and it’ll do the work for you. Since, you seem to … Read more

Accessing last x characters of a string in Bash

Last three characters of string: ${string: -3} or ${string:(-3)} (mind the space between : and -3 in the first form). Please refer to the Shell Parameter Expansion in the reference manual: ${parameter:offset} ${parameter:offset:length} Expands to up to length characters of parameter starting at the character specified by offset. If length is omitted, expands to the … Read more

How do I move a Git branch out into its own repository?

You can simply push a branch to a new repository. All of its history will go with it. You can then choose whether to delete the branch from the original repository. e.g. git push url://to/new/repository.git branch-to-move:new-branch-name For a new repository, new-branch-name is typically master. Creating a new, empty repository can be done with git init.

The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe

The R Language Definition is handy for answering these types of questions: http://cran.r-project.org/doc/manuals/R-lang.html#Indexing R has three basic indexing operators, with syntax displayed by the following examples x[i] x[i, j] x[[i]] x[[i, j]] x$a x$”a” For vectors and matrices the [[ forms are rarely used, although they have some slight semantic differences from the [ form … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)