473,748 Members | 7,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

str() or repr()

Have reasently upgraded to PySQLite 0.5.
I now have to "typecast" returned values to the "string expecting" GUI
widgets (wxPython).

Afrer reading the explanation, I'm still not clearer wich is better to
use... str() or repr()

example: self.wxTextCtrl .Setvalue( str(val["typedate"]))
## or repr(val["typedate"])

self.wxTextCtrl .Setvalue( str(val["typefloat"]))
## or repr(val["typefloat"])

TIA.
T

Jul 18 '05 #1
0 1269

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1545
by: George Sakkis | last post by:
Hi all, I find the string representation behaviour of builtin containers (tuples,lists,dicts) unintuitive in that they don't call recursively str() on their contents (e.g. as in Java) : ########################################### >>> class A(object): >>> def __str__(self): return "a"
11
3478
by: Brent | last post by:
I'd like to subclass the built-in str type. For example: -- class MyString(str): def __init__(self, txt, data): super(MyString,self).__init__(txt) self.data = data
5
2628
by: Johny | last post by:
Where and when is good/nescessary to use `repr` instead of `str` ? Can you please explain the differences Thanks LL
2
1393
by: adima | last post by:
Hi All! Sorry, my English isnt good, but get a try to describe my problem. Today we wrote next script: import os, glob, time, string files_to_test = ( "J:\\BWNEW\\!Unerase\\test.test", "L:\\Temp\Nick\ \test.test", "F:\\TRANSIT\\nick\\test.test") outfile="c:\\temp\\statistic"
0
818
by: Gabriel Genellina | last post by:
Hello Is this the intended behavior? Python 3.0a4+ (py3k, Apr 12 2008, 02:53:16) on win32 Type "help", "copyright", "credits" or "license" for more information. "b'abc'" 'abc' 'abc'
16
3028
by: Christian Heimes | last post by:
Gabriel Genellina schrieb: Yes, it's on purpose but it's a bug in your application to call str() on a bytes object or to compare bytes and unicode directly. Several months ago I added a bytes warning option to Python. Start Python as "python -bb" and try it again. ;) Christian
14
1500
by: Russell E. Owen | last post by:
I have code like this: except Exception, e: self.setState(self.Failed, str(e)) which fails if the exception contains a unicode argument. I did, of course, try unicode(e) but that fails. The following works, but seems rather messy: except Exception, e:
6
1422
by: Rafe | last post by:
Forgive me if I mangle any terminology here, but please correct me if I do... I have an object which acts exactly like a string as long as I stay in Python land. However, I am using the object in Softimage|XSI a 3D application on Windows. It was created while (briefly) owned by Microsoft, so knowledge of COM with excel or anything else should be applicable I should think. I should also say I am a COM novice and still learning Python...
19
5340
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to return a printable string. If no argument is given, returns the empty string, ''.
0
8828
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,...
0
9537
Oralloy
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...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
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...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.