Select to view content in your preferred language

Strip database.DBO from name

1982
2
03-01-2013 01:51 PM
MarkPaulson
Occasional Contributor
Newbie to python and I was wondering if there is a way to remove database.DBO. from database.DBO.feature.
feature = database.DBO.feature[13:] works, but seems a little of a kludge.
Tags (2)
0 Kudos
2 Replies
by Anonymous User
Not applicable
Newbie to python and I was wondering if there is a way to remove database.DBO. from database.DBO.feature.
feature = database.DBO.feature[13:] works, but seems a little of a kludge.


This should do it

feature = database.DBO.feature

new_name = feature.split('.')[-1]


[-1] is the last item in the list, which is what comes after the last period.  This should return 'feature'.
0 Kudos
MarkPaulson
Occasional Contributor
Thanks.. New it had to be simpler.
0 Kudos