I m using Python 2.5. The dll i imported is created using clr.
The dll function is returning a string. I m trying to apply "partition" attribute to it. I m not able to do it. Even the partition is not working.
I think "all stringd returned from clr are returned as unicode". Help me please.Its very urgent.

Recommended Answers

All 3 Replies

Perhaps you need to do something like:

# Assuming returned string is named inp_chrs
inp_chrs = str( inp_chrs )
inp_chrs.partition( my_sep )

Does that make sense? Simply convert it to a pure python string using the str() method.

Thank you for your reply.

It's not possible to convert unicode strings to string using str().
It wil not be able to encode some characters.

Can you find me help using encode()

Perhaps you need to do something like:

# Assuming returned string is named inp_chrs
inp_chrs = str( inp_chrs )
inp_chrs.partition( my_sep )

Does that make sense? Simply convert it to a pure python string using the str() method.

Thank you for your reply jlm699 .I want to know another issue. The exact problem is the string that is being returned from VB .NET contains strings seperated with '\r'.But while reaching Python '|r' becomes '\\r'.So i was not getting the right string aftr conversion also.Now i managed by giving '\\r' in my split function.I want to know about this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.