Can we have change a unicode string Type object to a Tuple type
object.. If so how ???? 4 2254 la************* *@gmail.com schrieb:
Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?
Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.
diez
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
laxmikiran.ba.. .@gmail.com schrieb:
Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?
Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.
diez
**********
I have to get few strings from an application(str ings of different
languages..ex: korean,japanese ,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.Whe n Iam using pyRXPU iam getting the
following error.
Traceback (most recent call last):
File "D:\LanguageScr ipts\Screens.py ", line 106, in
test_1_01_DoSom ething
TitlenSoftkeyfn ()
File "D:\LanguageScr ipts\EventLog_S creens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.c urrentText
File "D:\LanguageScr ipts\XmlWrapper .py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..
When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work. la************* *@gmail.com schrieb:
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
>laxmikiran.ba. ..@gmail.com schrieb:
>>Can we have change a unicode string Type object to a Tuple type object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?
Tuples are basically structs, unicode objects are strings. There is no canonical way to convert them. Tell us more about the problem you want to be solved, and we might help you better.
diez
**********
I have to get few strings from an application(str ings of different
languages..ex: korean,japanese ,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.Whe n Iam using pyRXPU iam getting the
following error.
Traceback (most recent call last):
File "D:\LanguageScr ipts\Screens.py ", line 106, in
test_1_01_DoSom ething
TitlenSoftkeyfn ()
File "D:\LanguageScr ipts\EventLog_S creens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.c urrentText
File "D:\LanguageScr ipts\XmlWrapper .py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..
When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work.
I don't know pyRXP and pyRXPU, and especially not how you use them.
Who's responsible for writing that "XmlWrapper.py" ? He or she obviously
expected a tuple returned that was basically a DOM-tree (tag, attrs,
childs and something called spare)
But changing to pyRXPU seems to break the protocol here. But I can't
judge that without seeing more code.
diez
On May 24, 11:19 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
laxmikiran.ba.. .@gmail.com schrieb:
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
laxmikiran.ba.. .@gmail.com schrieb:
>Can we have change a unicode string Type object to a Tuple type object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?
Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.
diez
**********
I have to get few strings from an application(str ings of different
languages..ex: korean,japanese ,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.Whe n Iam using pyRXPU iam getting the
following error.
Traceback (most recent call last):
File "D:\LanguageScr ipts\Screens.py ", line 106, in
test_1_01_DoSom ething
TitlenSoftkeyfn ()
File "D:\LanguageScr ipts\EventLog_S creens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.c urrentText
File "D:\LanguageScr ipts\XmlWrapper .py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..
When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work.
I don't know pyRXP and pyRXPU, and especially not how you use them.
Who's responsible for writing that "XmlWrapper.py" ? He or she obviously
expected a tuple returned that was basically a DOM-tree (tag, attrs,
childs and something called spare)
But changing to pyRXPU seems to break the protocol here. But I can't
judge that without seeing more code.
Looks like the OP needs to RTFM. Here's an excerpt from an article by
David Mertz ( http://www.ibm.com/developerworks/library/x-
matters29.html) :
"""
pyRXP's tuple tree data structure
pyRXP (and RXP itself) uses an efficient, lightweight tree
representation of XML documents. Each node in a pyRXP tree is simply a
tuple of the form:
(tagname, attr_dict, child_list, reserved)
No specialized Python classes are used in the representation -- just
tuples, dicts, lists, and strings (and None in the reserved position).
Perhaps surprisingly, this form is adequate to represent all the
information in an XML document. The tagname is a straightforward
string; the attribute dictionary is a dictionary that maps attributes
to values, as you would expect. ***The child list is more subtle:
Strings can be interleaved with tuples in the list, indicating a mixed
content element.*** Moreover, an element that has no content is
represented by an empty child list, but a self-closed tag is
represented by None.
"""
"subtle" is not the word I would have used :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: oom |
last post by:
I am a bit of a newbie when it comes to python, when working with
lists today I noticed some very odd behaviour, any suggestions
welcome:
Python 2.2.3 (#1, Nov 6 2003, 14:12:38)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> firstlist=
>>> secondlist=firstlist
>>> print (firstlist,secondlist)
|
by: manstey |
last post by:
I am writing a program to translate a list of ascii letters into a
different language that requires unicode encoding. This is what I have
done so far:
1. I have # -*- coding: UTF-8 -*- as my first line.
2. In Wing IDE I have set Default Encoding to UTF-8
3. I have imported codecs and opened and written my file, which doesn't
have a BOM, as encoding=UTF-8
4. I have written a dictionary for translation, with entries such as...
|
by: Dennis Benzinger |
last post by:
Hi!
The following program in an UTF-8 encoded file:
# -*- coding: UTF-8 -*-
FIELDS = ("Fächer", )
FROZEN_FIELDS = frozenset(FIELDS)
FIELDS_SET = set(FIELDS)
|
by: Jon Bowlas |
last post by:
Hi listers,
I wrote this script in Zope some time ago and it worked for a while, but now
I'm getting the following error:
TypeError: coercing to Unicode: need string or buffer, NoneType found
Here's my script:
results = context.module_retriever().tuples() # call to ZSQLMethod
converted =
|
by: Jim |
last post by:
Hello,
I'm trying to write exception-handling code that is OK in the
presence
of unicode error messages. I seem to have gotten all mixed up and
I'd
appreciate any un-mixing that anyone can give me.
I'm used to writing code like this.
| |
by: Gerry |
last post by:
I'm using pyExcelerator and xlrd to read and write data from and to
two spreadsheets.
I created the "read" spreadsheet by importing a text file - and I had
no unicode aspirations.
When I read a cell, it appears to be unicode u'Q1", say.
I can try cleaning it, like this:
|
by: pythonuser |
last post by:
Can we change a unicode object to a object of tuple type...
|
by: laxmikiran.bachu |
last post by:
Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
|
by: hidrkannan |
last post by:
I am reading a set of data from the excel workbook.
Data are contained in 2 columns. Column A contains the names and Column B contains values. The issue is the value can be of any type integer, float, string, list or a tuple. When I read the data from a Cell it is read as of data type unicode. I would like to convert the unicode data type to list type if the data I read is of list type and similarly for tuples.
Please suggest if this...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |