Qt String Question

Discussion in 'Python' started by Michael McGarry, Dec 13, 2004.

  1. Hi,

    How do I convert from a qt.QString to a Python string?

    Michael
     
    Michael McGarry, Dec 13, 2004
    #1
    1. Advertising

  2. Michael McGarry wrote:
    > Hi,
    >
    > How do I convert from a qt.QString to a Python string?
    >
    > Michael

    Apparently the ascii() method of QString does this. (I answered my own
    question).

    sorry for wasting newsgroup space.
     
    Michael McGarry, Dec 13, 2004
    #2
    1. Advertising

  3. > Michael McGarry wrote:
    >> Hi,
    >>
    >> How do I convert from a qt.QString to a Python string?
    >>
    >> Michael

    > Apparently the ascii() method of QString does this. (I answered my own
    > question).


    Or use the str() builtin.

    Phil
     
    Phil Thompson, Dec 13, 2004
    #3
  4. Michael McGarry wrote:
    > Michael McGarry wrote:
    >
    >> Hi,
    >>
    >> How do I convert from a qt.QString to a Python string?
    >>
    >> Michael

    >
    > Apparently the ascii() method of QString does this. (I answered my own
    > question).
    >
    > sorry for wasting newsgroup space.


    Depending on the kind of string you have, latin1() may be a better
    solution ...
     
    Pierre Barbier de Reuille, Dec 13, 2004
    #4
  5. Phil Thompson wrote:

    >> Michael McGarry wrote:
    >>> Hi,
    >>>
    >>> How do I convert from a qt.QString to a Python string?
    >>>
    >>> Michael

    >> Apparently the ascii() method of QString does this. (I answered my own
    >> question).

    >
    > Or use the str() builtin.
    >
    > Phil


    unicode() is even better because QString might contain non-ASCII
    characters.

    Detlev
    --
    Detlev Offenbach
     
    Detlev Offenbach, Dec 13, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mladen Adamovic
    Replies:
    0
    Views:
    777
    Mladen Adamovic
    Dec 4, 2003
  2. Mladen Adamovic
    Replies:
    3
    Views:
    14,776
    Mladen Adamovic
    Dec 5, 2003
  3. Matt
    Replies:
    3
    Views:
    549
    Tor Iver Wilhelmsen
    Sep 17, 2004
  4. Bruce Sam
    Replies:
    15
    Views:
    8,064
    John C. Bollinger
    Nov 19, 2004
  5. =?Utf-8?B?UmFqZXNoIHNvbmk=?=

    'System.String[]' from its string representation 'String[] Array'

    =?Utf-8?B?UmFqZXNoIHNvbmk=?=, May 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,818
    =?Utf-8?B?UmFqZXNoIHNvbmk=?=
    May 4, 2006
Loading...

Share This Page