I've seen some examples like this:
for name in os.listdir(u'somedir') :
my problem is that I'm getting the somedir as a variable, so how can I append the 'u' literal?
something like
for name in ops.listdir(u+somedir)
?
I've seen some examples like this:
for name in os.listdir(u'somedir') :
my problem is that I'm getting the somedir as a variable, so how can I append the 'u' literal?
something like
for name in ops.listdir(u+somedir)
?
In case someone comes across this post like I did:
A little hack you can do is (u'%s' % somedir)
Simple solution is to use unicode function as follows:
x = unicode('1.2.3.4')
print x
u'1.2.3.4'
type(x)
type 'unicode'
It shows type as unicode now.